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:
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
(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
This is my code, yet on the line let db = Firestore.firestore(), it not working
I have added the FirebaseApp.configure and import Firebase at the start. I also followed all instructions in the lessons.
Thanks! Any help would be deeply appreciated!
I get the following error Publishing changes from within view updates is not allowed, this will cause undefined behavior.and do not get how to fix this issue. I already found out it should be to do something with @state, but I am new in swiftui.
Hi!
I getting a lot of errors in ForEach and I don't know why at all.
Here is the code: In line 19
"Generic struct 'ForEach' requires that 'Artwork' conform to 'RandomAccessCollection'"
Thanks! Any help would be deeply appreciated!
Code:
Model:
ViewModel:
I am so confused with linking one collection to another (Foreach),
any feedback would be appreciated. Thanks
I want my artwork to be displayed in that exhibition.
if collection: exhibition.id = collection: artwork.exhbtid
show: infomation artwork (Infoview)
thanks for helping, I am so confused sorry
Code:
Exhibition: Model, ViewModel
Artwork: Model, ViewModel
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!
**
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: