Posts

Post marked as solved
2 Replies
488 Views
I’m having trouble wrapping my head around the how I might build a fantasy sports app that I have in mind.  I can get real-time sports data from an API, so users’ teams can have scores, based on the players they pick and how those players perform. That's easy. I’m having trouble in the following 2 areas… How would I display a leaderboard? I want all users’ scores to be displayed on a leaderboard. It seems like CloudKit can do this. Is that the best solution or is there a better option? (I really don’t want to use Game Center). Here’s the second thing I’m struggling with. I’ve worked with background tasks, but I don’t think those would work because I want the real-time sports updates to be pushed to each user. If I use background tasks, the users’ scores and the leaderboard won’t be updated if the device is in low battery mode or off. With this in mind, should I be pulling data from the API to a server, and then pushing notifications to users? If so, this project gets suuuper complicated, and I need to learn something like Vapor and working with a database. I might be in over my head here. Hopefully, I can get some tips/guidance!
Posted
by c0nman.
Last updated
.
Post not yet marked as solved
2 Replies
358 Views
If I put this code into a swiftui struct view, i can magically use it in the body within a list, but if I put the same code in a separate class, and then try to print myShows or myShows[0] or anything like that, it doesn't work. I'm assuming myShows never actually gets initialized, but i'm unsure of how to get the fetch request results into the myShows object. I don't understand how it just magically works in the struct view.@Environment(\.managedObjectContext) var managedObjectContext @FetchRequest( entity: MyShow.entity(), sortDescriptors: [ NSSortDescriptor(keyPath: \MyShow.name, ascending: true) ] ) var myShows: FetchedResults
Posted
by c0nman.
Last updated
.