<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TipKit",
  "identifier" : "/documentation/TipKit/TipUIView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "TipKit"
    ],
    "preciseIdentifier" : "c:@M@TipKit@objc(cs)TipUIView"
  },
  "title" : "TipUIView"
}
-->

# TipUIView

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

```
@MainActor @objc @preconcurrency final class TipUIView
```

## Overview

Use this view to create a tip you want to display and lay out as a <doc://com.apple.documentation/documentation/UIKit/UIView>.
To configure the content and appearance of your view, use the [`init(_:arrowEdge:actionHandler:)`](/documentation/TipKit/TipUIView/init(_:arrowEdge:actionHandler:)) function and provide a tip along with an optional arrow edge and optional action. Set the background color of your tip view using [`backgroundColor`](/documentation/TipKit/TipUIView/backgroundColor).

Adding and removing TipUIView from your app is done by listening to a tip’s [`shouldDisplayUpdates`](/documentation/TipKit/Tip/shouldDisplayUpdates) or [`statusUpdates`](/documentation/TipKit/Tip/statusUpdates).

```swift
import TipKit
import UIKit

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: UIViewController {
    private var catTracksFeatureTip = CatTracksFeatureTip()
    private var tipObservationTask: Task<Void, Never>?
    private weak var tipView: TipUIView?    

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        tipObservationTask = tipObservationTask ?? Task { @MainActor in
            for await shouldDisplay in catTracksFeatureTip.shouldDisplayUpdates {
                if shouldDisplay {
                    let tipHostingView = TipUIView(catTracksFeatureTip)
                    tipHostingView.translatesAutoresizingMaskIntoConstraints = false
                                        
                    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 viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)

        tipObservationTask?.cancel()
        tipObservationTask = nil
    }
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)