---
title: TipNSView
framework: tipkit
role: symbol
role_heading: Class
path: tipkit/tipnsview
---

# TipNSView

A user interface element that represents a tip in AppKit applications.

## Declaration

```swift
@MainActor @objc @preconcurrency final class TipNSView
```

## Overview

Overview You create a tip view by providing a tip and an optional arrow edge. The tip is a type that conforms to the Tip protocol. The arrow edge is a directional arrow pointing away from the tip. Use this view to create a tip you want to display and lay out as a NSView. Adding and removing TipNSView from your app is done by listening to a tip’s shouldDisplayUpdates or statusUpdates. import Cocoa import TipKit

struct CatTracksFeatureTip: Tip {     var title: Text {         Text("Sample tip title")     }

var message: Text? {         Text("Sample tip message")     }

var image: Image? {         Image(systemName: "globe")     } }

class CatTracksViewController: NSViewController {     private var catTracksFeatureTip = CatTracksFeatureTip()     private var tipObservationTask: Task<Void, Never>?     private weak var tipView: TipNSView?

override func viewDidAppear() {         super.viewDidAppear()

tipObservationTask = tipObservationTask ?? Task { @MainActor in             for await shouldDisplay in catTracksFeatureTip.shouldDisplayUpdates {                 if shouldDisplay {                     let tipHostingView = TipNSView(catTracksFeatureTip)                     view.addSubview(tipHostingView)

view.addConstraints([                         tipHostingView.centerYAnchor.constraint(equalTo: view.centerYAnchor),                         tipHostingView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20.0),                         tipHostingView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20.0)                     ])

tipView = tipHostingView                 }                 else {                     tipView?.removeFromSuperview()                     tipView = nil                 }             }         }     }

override func viewDidDisappear() {         super.viewDidDisappear()

tipObservationTask?.cancel()         tipObservationTask = nil     } }

## Topics

### Initializers

- [init(_:arrowEdge:actionHandler:)](tipkit/tipnsview/init(_:arrowedge:actionhandler:).md)

### Instance Properties

- [backgroundColor](tipkit/tipnsview/backgroundcolor.md)
- [backgroundStyle](tipkit/tipnsview/backgroundstyle.md)
- [cornerRadius](tipkit/tipnsview/cornerradius.md)
- [imageSize](tipkit/tipnsview/imagesize.md)
- [imageStyle](tipkit/tipnsview/imagestyle.md)
- [viewStyle](tipkit/tipnsview/viewstyle.md)

## Relationships

### Inherits From

- [NSView](appkit/nsview.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSAccessibilityElementProtocol](appkit/nsaccessibilityelementprotocol.md)
- [NSAccessibilityProtocol](appkit/nsaccessibilityprotocol.md)
- [NSAnimatablePropertyContainer](appkit/nsanimatablepropertycontainer.md)
- [NSAppearanceCustomization](appkit/nsappearancecustomization.md)
- [NSCoding](foundation/nscoding.md)
- [NSDraggingDestination](appkit/nsdraggingdestination.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)

## See Also

### AppKit Views

- [TipNSPopover](tipkit/tipnspopover.md)
