Swift
TipKit - One More New Framework of Apple
7 ay önce yazıldı. | Okuma süresi: 3 dk.

With iOS 17, we have acquired a new framework. Don't be fooled by its name, which is Tipkit; I believe it can become quite useful. Of course, since it's still in the experimental version, it has various bugs.

Due to its structure, Tipkit allows for the display of some tips, so to speak, to assist users. Of course, at its current state, it doesn't have many animations, but it still has a nice structure.

With TipKit, you can provide detailed information on some login screens in conjunction with user login and registration screens. You can think of it as something equivalent to that famous (info) button in a user login form that tells you which characters are valid.

The structure is quite simple. First, you create a Tip Struct model. Then, you integrate it into the contentview or where you want.

That is model structure of Tip


import TipKit

struct FavPlace: Tip {
var title: Text {
Text("Save as a Favorite")
}


var message: Text? {
Text("Your favorite place always appear at the top of the list.")
}


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


* Dont forget import TipKit, no need SwiftUI import for this section. In this model there is title, text and image. That fully access to our Tip.

Then we integrate it to our content view.


import SwiftUI
import TipKit

struct ContentView: View {


var favoritePlaceTip = FavPlace()

var body: some View {

VStack {
TipView(favoritePlaceTip, arrowEdge: .bottom)
Image(systemName: "star")
.imageScale(.large)
Spacer()
}
.task {
try? Tips.configure([
.displayFrequency(.immediate),
.datastoreLocation(.applicationDefault)
])
}.padding()

}
}


* here you need to import both Tipkit and SwiftUI.
Then create variable from your tip struct model. And called "favoritePlaceTip" (You can re-name whatever you want!)
Then in example we see the Tip directly when open to view.

Bec of that no need any more variable or action.

Just TipView "theme" and define place of tip -> (.bottom)

Then writing task for run directly. Aso there is more configs. (for info please check that link for apple document)

Here we go!

*The sample comes from other sources, as you can see below.


Page generated in 0.0166 seconds.