You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 9, 2025. It is now read-only.
So, first of all, I'm a total SwiftUI beginner so bare with me.
I'm working on my first app in which I would like a page view controller that allows me to swipe between views. In my app I'm fetching calendar events which I'm accessing in my views through an observable object. The problem is that when I'm trying to access my observed object in iPages, the array is empty and I can't understand why. Here is a simplified example:
class EventsRepository: ObservableObject {
static let shared = EventsRepository()
// Code
@Published var events: [EKEvent]?
// Code
let events = self.eventStore.events(matching: predicate)
}
import iPages
struct ContentView: View {
@ObservedObject var eventsRepository = EventsRepository.shared
@State private var currentPage = 0
var body: some View {
Text(String(describing: eventsRepository.events)) // This is **not** empty
iPages(selection: $currentPage) {
Text(String(describing: eventsRepository.events)) // This **is** nil
}
}
}
If this is not a problem with iPages I would really appreciate if you could try to explain to me what I'm doing wrong.
So, first of all, I'm a total SwiftUI beginner so bare with me.
I'm working on my first app in which I would like a page view controller that allows me to swipe between views. In my app I'm fetching calendar events which I'm accessing in my views through an observable object. The problem is that when I'm trying to access my observed object in iPages, the array is empty and I can't understand why. Here is a simplified example:
If this is not a problem with iPages I would really appreciate if you could try to explain to me what I'm doing wrong.
Thanks!