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