Skip to content

Instantly share code, notes, and snippets.

@amosgyamfi
Created February 21, 2024 05:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amosgyamfi/a7ebe0ccfc7b17ee1b38bc9e60977168 to your computer and use it in GitHub Desktop.
Save amosgyamfi/a7ebe0ccfc7b17ee1b38bc9e60977168 to your computer and use it in GitHub Desktop.
//
// CustomRecordingTipView.swift
// VoiceChat
//
// Created by Amos Gyamfi on 20.2.2024.
//
import SwiftUI
import TipKit
struct CustomRecordingTipView: View {
@State private var favoriteTip = FavoriteTip()
var body: some View {
NavigationStack {
List {
}
.navigationTitle("Messages")
.toolbar {
ToolbarItem(placement: .topBarTrailing) {
Button {
//print(favoriteTip.status, FavoriteTip.showTip)
FavoriteTip.showTip = true
} label: {
Image(systemName: "star")
}
.popoverTip(favoriteTip, arrowEdge: .top)
}
}
}
}
}
struct FavoriteTip: Tip {
@Parameter
static var showTip: Bool = false
static var numberOfTimesVisited: Event = Event(id: "")
var title: Text {
Text("Record Your Voice or an Audio")
}
var message: Text? {
Text("Hold to record an audio, release the finger to send it")
}
var asset: any View {
//Image(systemName: "star")
Label("Show recording steps", systemImage: "recordingtape.circle.fill")
}
var options: [TipOption] {
return [
Tips.MaxDisplayCount(3)
]
}
var rules: [Rule] {
return [
#Rule(FavoriteTip.$showTip) {$0 == true}
]
}
}
#Preview {
CustomRecordingTipView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment