Post

Replies

Boosts

Views

Activity

Reply to Random Look Around Coordinates
Have you tried catching the error from your try await request.scene? I have just finished a similar task and no issues. Perhaps also try using MainActor.run so that you are not combining async/await with DispatchQueue? I've heard others having issues when mixing the two. Task { do { let request = MKLookAroundSceneRequest(coordinate: coordinate) let scene = try await request.scene await MainActor.run { self.lookAroundScene = scene } } catch { print(error.localizedDescription) // This will help! generateRandomCoordinate() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’23
Reply to iOS 16 Live Activity + SwiftUI Previews
@jabhiji @waohqc @amit12we I found a way! I initialize some dummy ActivityAttributes and ContentState then use attributes.previewContext(contentState, viewKind: .dynamicIsland(.compact)) Full example struct HuntLiveActivityWidget_Previews: PreviewProvider { static let attributes = HuntAttributes.init(huntID: "1234", huntName: "Hunt name", numberOfClues: 10) static let contentState = HuntAttributes.ContentState(currentClueText: "This is the current clue to be solved.", currentClueIndex: 0, currentHuntProgress: 0.1) static var previews: some View { attributes .previewContext(contentState, viewKind: .dynamicIsland(.compact)) .previewDisplayName("Island Compact") attributes .previewContext(contentState, viewKind: .dynamicIsland(.expanded)) .previewDisplayName("Island Expanded") attributes .previewContext(contentState, viewKind: .dynamicIsland(.minimal)) .previewDisplayName("Minimal") attributes .previewContext(contentState, viewKind: .content) .previewDisplayName("Notification") } }
Topic: App & System Services SubTopic: General Tags:
Oct ’23
Reply to RequestReviewAction + NavigationLink
To clarify, the following will work in DetailView... .task { guard let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene else { return } SKStoreReviewController.requestReview(in: scene) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to Using Maps in App Intents
You should look into MKMapSnapshotter. You should be able to create and display an image of the location you want. AppIntent does not currently work with scrollable content.
Replies
Boosts
Views
Activity
Mar ’25
Reply to Empty Journal suggestions
Also, I cannot seem to find the correct 'Tag' for Journal. I tried 'Journal', 'Suggestions', 'JournalingSuggestions'... anyone know?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Random Look Around Coordinates
Have you tried catching the error from your try await request.scene? I have just finished a similar task and no issues. Perhaps also try using MainActor.run so that you are not combining async/await with DispatchQueue? I've heard others having issues when mixing the two. Task { do { let request = MKLookAroundSceneRequest(coordinate: coordinate) let scene = try await request.scene await MainActor.run { self.lookAroundScene = scene } } catch { print(error.localizedDescription) // This will help! generateRandomCoordinate() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to iOS 16 Live Activity + SwiftUI Previews
@jabhiji @waohqc @amit12we I found a way! I initialize some dummy ActivityAttributes and ContentState then use attributes.previewContext(contentState, viewKind: .dynamicIsland(.compact)) Full example struct HuntLiveActivityWidget_Previews: PreviewProvider { static let attributes = HuntAttributes.init(huntID: "1234", huntName: "Hunt name", numberOfClues: 10) static let contentState = HuntAttributes.ContentState(currentClueText: "This is the current clue to be solved.", currentClueIndex: 0, currentHuntProgress: 0.1) static var previews: some View { attributes .previewContext(contentState, viewKind: .dynamicIsland(.compact)) .previewDisplayName("Island Compact") attributes .previewContext(contentState, viewKind: .dynamicIsland(.expanded)) .previewDisplayName("Island Expanded") attributes .previewContext(contentState, viewKind: .dynamicIsland(.minimal)) .previewDisplayName("Minimal") attributes .previewContext(contentState, viewKind: .content) .previewDisplayName("Notification") } }
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Game Center authentication workflow
FYI, I brought this up to a few members of the Game Center team at WWDC '23. It seemed as though it was the first they'd heard of it and said they would investigate (yay!). TBD 😅
Topic: Graphics & Games SubTopic: GameKit Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to RequestReviewAction + NavigationLink
To clarify, the following will work in DetailView... .task { guard let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene else { return } SKStoreReviewController.requestReview(in: scene) }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Location Manager init called over 100 times on launch
I suspect the issue was at the call site? Hope you've solved the mystery since! My first instinct is also to maybe try a Singleton? static let shared: LocationManager = LocationManager()
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’22