Created
February 21, 2024 05:38
-
-
Save amosgyamfi/a7ebe0ccfc7b17ee1b38bc9e60977168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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