Skip to content

This tutorial teaches how to use the TipKit Framework for SwiftUI.

License

Notifications You must be signed in to change notification settings

fatihdurmaz/TipKitExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TipKitExample

Swift Platform Swift License

This tutorial teaches how to use the TipKit Framework for SwiftUI. The TipKit Framework allows you to display tips that help users explore features in your application.

Usage

The TipKit Framework provides an API for displaying tips in SwiftUI. Tips can help users discover new features in your application and better understand existing features.

Tip Struct

struct UserSortTip: Tip {
    var title: Text {
        Text("Sort by Name")
    }
    var message: Text? {
        Text("Users is sorted by name.")
    }
    var image: Image? {
        Image(systemName: "arrow.up.arrow.down")
    }
}

struct UserAddressTip: Tip {
    var title: Text {
        Text("Click to Info Icon")
    }
    var message: Text? {
        Text("You can see users addresses.")
    }
    var image: Image? {
        Image(systemName: "info.circle")
    }
}

Example

import SwiftUI
import TipKit

struct ContentView: View {
   var userSortTip = UserSortTip()
    var addressSortTip = AdressSortTip()

struct ContentView: View {
    var body: some View {
        // İpucu gösterecek view'ı oluşturun.
        TipView(addressSortTip)

        // Bir elemente dahil ederek ipuçlarını gösterin.
        Button("Sort") {
        }
        .popoverTip(userSortTip)

    }
  }
}

Tip Configure

import SwiftUI
import TipKit

@main
struct TipKitExampleApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .task {
                    
                    //try? Tips.resetDatastore() 
                    
                    try? Tips.configure([
                        .displayFrequency(.immediate),
                        .datastoreLocation(.applicationDefault)
                    ])
                }
        }
    }
}

About

This tutorial teaches how to use the TipKit Framework for SwiftUI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages