UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Using CoreData for a reference guide, and if so, how to preload the data?

Forums > Swift

Hi everyone, I'm looking to build an app that basically will take an existing game reference guide and make it searchable in an app. The reference guide is a very straightforward list of words and their definitions. From the user's point of view it will be read only. Is this a good candidate for a CoreData database? If it is, what's the best way to preload the data into the database the first time the user opens the app?

The data itself is in a text file which will be in the app package (it won't need to be changed dynamically) and I'll be using delimiters to split the text into the name and definition columns.

Thanks, Alistair

3      

I don't have an answer, but this is something I've been curious about for a while and would like to be notified of any responses. :D

2      

I am fairly new and learning so please take that into account with my answer...

Is there a reason you want to use Core Data? From your explanation, and my limited knowledge, it seems like the juice isn't worth the squeeze.

To me, you should just leave this in a dictionary as part of your app instead of trying to push it into Core Data. Then you should be able to use .contains or another method if the user wants to search.

I also watched Paul's HWS Live yesterday and he showed off a Searchable feature that adds a search bar in a list. I haven't played with this yet but it may be something you wish to use. For example, if everything is in a String, String dictionary, you could list the word and definition in a list and search thru it.

I hope this makes sense. If I missed the boat, I apologize. So many have helped me on this forum and I am just trying to use my limited knowledge to give back some.

2      

I was wondering if I was perhaps overdoing it by using CoreData. As you said, it may be better to go with a more straightforward approach.

Appreciate the input!

2      

For what it's worth, I'm fairly certain this (prepopulated coredata) is the approach several apps take with similar featuresets (reference material).

Even if coredata is overkill, it's probably a great learning opportunity.

2      

TAKE YOUR SKILLS TO THE NEXT LEVEL If you like Hacking with Swift, you'll love Hacking with Swift+ – it's my premium service where you can learn advanced Swift and SwiftUI, functional programming, algorithms, and more. Plus it comes with stacks of benefits, including monthly live streams, downloadable projects, a 20% discount on all books, and free gifts!

Find out more

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.