Post

Replies

Boosts

Views

Activity

(SwiftUI) Can't Click Button on Sheet Modals Show View
(SwiftUI) Can't Click Button on Sheet Modals Show View when detection beacon present sheet model. in the sheet model there are 2 button. i want to click on more experience (button) to present another view. when i click on button more experience it doesn't present the view. Hope you can help me, Thanks! Any help would be deeply appreciated! I'm new in swiftui, Please forgive me if I make a few mistakes My English isn’t so great. **Code: ** import Combine import CoreLocation import SwiftUI struct ContentView: View { @ObservedObject var detector = BeaconDetector() @EnvironmentObject var popupManager: PopupManager @EnvironmentObject var authViewModel: AuthViewModel @State var isNavigationBarHidden: Bool = true @State var isShowAlert = false @State var showDetail = false @State var isActive = false // added @StateObject var artwork = ArtworkViewModel() var body: some View { VStack { Group { if let userSession = authViewModel.userSession { // logged in user if detector.lastDistance == .immediate { if !detector.beaconFound { Text("") .onAppear { // Show the alert (view appear) isShowAlert = true } .alert(isPresented: $isShowAlert) { Alert( title: Text("Hi! Art Lovers"), message: Text("We want to help you find your nearest Artwork 🖼️"), dismissButton: .default(Text("OK")) { showDetail = true } ) } } else if let getArtwork = artwork.artworks.first(where: { $0.id == "1" }), getArtwork.uuidbeacon == BeaconDetector.getBeaconID() { NavigationLink(destination: ArtworkInfoBeacon(artwork: getArtwork), isActive: $isActive) { ArtworkInfoBeacon(artwork: getArtwork) } .hidden() // hide the navigation link .onAppear { isActive = true } .onDisappear { isActive = false } .simultaneousGesture(TapGesture().onEnded { showDetail = true }) } } else { mainInterfaceView } } else { // no logged in user LoginView() } } } .sheet(isPresented: $showDetail) { // present the ArtworkInfoBeacon view as a sheet if let getArtwork = artwork.artworks.first(where: { $0.id == "1" }), getArtwork.uuidbeacon == BeaconDetector.getBeaconID() { ArtworkInfoBeacon(artwork: getArtwork) } } } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView(artworkinfo: Artworkinfo( id: 0, atwName: "Anthropocene", atwArtist: "Sirawich", ateCate: "Painting", atwDesc: "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal", atwSound: "mp4", atwImg: "AnthropoceneCover", idExhbt: 0), exhibition: Exhibition(id: "", exhbtstate: "", exhbtname: "", exhbtstr: "", exhbtend: "", exhbtdesc: "", timestr: "", timeend: "", exhbtorgnz: "", loctname: "", loctdetail: "", ticket: "", imgcover: ""), artwork: ArtworkViewModel()) } } extension ContentView { var mainInterfaceView: some View { VStack { MainTabView() } } } code ArtworkinfoBeacon: Button { print("Button Play") } label: { NavigationLink(destination:ArtworkPlayBeacon(artwork: artwork)){ HStack { Spacer() Text(" \(Image(systemName: "play.fill")) More Experience") .foregroundColor(.white) .padding(.vertical, 10) .font(.semiSub) Spacer() }.background(Color.primaryColor1) }.cornerRadius(24) .padding() } } // section play sound
0
0
556
Mar ’23
SwiftUI: Can't Show view
First Time: I detect beacons, Alert is displayed, to Show Artwork. But when I detect the beacons a second time, Alert not showing and the display of the screen is white I am new in swiftui, Please forgive me if I make a few mistakes My English isn’t so great. **Thanks! Any help would be deeply appreciated! **
2
0
654
Mar ’23
(EventKit) Problems with Adding Reminder Calendar Error, SwiftU
Hi! I getting a lot of errors in Adding Reminder and I don't know why at all. What happened to the database connection? Where did I go wrong. Any feedback would be appreciated. Thanks debug: error adding Error Domain=EKErrorDomain Code=2 "No start date has been set." UserInfo={NSLocalizedDescription=No start date has been set.} 2023-01-20 15:41:00.212842+0700 snp65-project[50253:1714614] [xpc] XPC connection was invalidated Here is the code:
0
0
672
Jan ’23
(ForEach-Error)SwiftUI, Firestore getting one collection and matching with another
I am so confused with linking one collection to another (Foreach) I want my artwork to be displayed in that exhibition. if collection: exhibition.id = collection: artwork.exhbtid show: infomation artwork (Infoview) Any feedback would be appreciated. Thanks Edit: now i found error I don't know what to do, Could you advise me ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>: the ID 1 occurs multiple times within the collection, this will give undefined results! ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>: the ID 1 occurs multiple times within the collection, this will give undefined results! ForEach<Array, String, ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>>: the ID 2 occurs multiple times within the collection, this will give undefined results! ForEach<Array, String, ForEach<Array, String, Optional<NavigationLink<ArtworkInfoCard, ArtworkInfoView>>>>: the ID 1 occurs multiple times within the collection, this will give undefined results! LazyVGridLayout: the ID UniqueID(value: 4196) is used by multiple child views, this will give undefined results! Code: Exhibition Model: Exhibition ViewModel: Artwork Model: Artwork ViewModel:
3
0
1.3k
Jan ’23