Trouble with iOS App Planning

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!

Accepted Answer

When is user score updated ?

  • When player plays (then he/she's not in background) ; the ranking may change, not the score.
  • in other cases ?

Is that a correct understanding ?

Did you consider:

  • keeping leaderboard on your server and update it there
  • pushing notification when score / ranking change
  • reload from server when user returns from background, in case he/she missed notification

With this in mind, should I be pulling data from the API to a server, and then pushing notifications to users?

Probably.

If so, this project gets suuuper complicated

Not necessary. CloudKit has push notification support, allowing you to set up a subscription that generates a push notification when content changes.

CloudKit isn’t really my field, but you can learn more about this in Remote Records.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Trouble with iOS App Planning
 
 
Q