Best storage and organisation approach IOS app - ios

I'm building an IOS app (native) where a number of football teams are presented on the screen for the user to select a favourite. Whats the best approach for storing / building these team objects in the app.
One possibility would be to collect all the teams from an API and store them in some kind of IOS storage / database component, however the teams will rarely change so it seems over kill. Another option is just to hard code it by creating each team in something like the app delegate or storing them in a plist.
Secondly each team will have images associated with them e.g. badge, players etc. Whats the best way to organise these image assets. From what I can see images can be grouped into folders in images.xassets however those folders are ignored when calling the image from code.
[UIImage imageNamed:#"badge"];
Which would be a problem since each team would have an image named badge. Should I prepend the image name with the corresponding team name or is there a better way to link and organise these assets to a given team.

I would look into sqlite data base with CoreData interface. You can organize perfectly well what you need. It also allows for image storage. If you've never worked with it, it migth be difficult at the beginning, but after the learning curve you'll find it really useful.

Related

I want to build an AR tool to place and store text files in a virtual space

It's called a memory palace (Read: 'Moonwalking with Einstein') it's an ancient tool used to memorize, in my case coding concepts and Spanish and Indonesian phrases.
I'm learning python now, but I'm not really sure what direction to move in and what stack should be used to build a project like this. it wouldn't be too complex, I just want to store and save "text files" in a virtual space like my bedroom or on my favorite hikes.
If anyone has insights or suggestions it'd be much appreciated.
Probably the two most common AR frameworks, on mobile devices anyway, at the moment are ARKit for iOS devices and ARCore for Android devices.
I am sure you can find comparisons of the strengths and weaknesses of each one but it is likely your choice will be determined by the type of device you have.
In either case, it sounds like you want to have 'places' you can return to over time and see your stored content. For this you could build on some common techniques:
link the AR object to some sort of image in the real world and when this image is recognised by the AR app, launch your AR object, in your case a text file.
use 'Cloud Anchors' - these are essentially anchors for AR objects that can persist over time, when you close the app and come back to it later, and even be shared between users on different devices.
You can find more information on cloud Anchors at the link below, including information on using them with iOS and on Android:
https://developers.google.com/ar/develop/java/cloud-anchors/overview-android

Best practice for storing and updating images in Xcode project

I am building my flash card iOS app for reviewing my learning Japanese using SwiftUI language.
The problem is how to storing and updating my images(>500 images). Please help me, any suggestion is appreciated, thanks for reading my post.
I think you're asking about how to manage 500+ images in an Xcode project. You could just add all the images to your project and load them as you would any image. You could use asset catalogs, which have the advantage that they let you store different versions of a resource for use on different devices, and only the ones needed for the device the app runs on will actually be installed on the device. See How Many Images Can/Should you Store in xcassets in Xcode? and Asset Catalog Format Reference for more information about asset catalogs. But any way you slice it, managing 500+ images is going to be cumbersome. There's probably a better way...
Managing all those images in your app isn't just a problem for you as the developer; building them into the app will also create problems for the user. Even if each image is relatively small, having hundreds of them in the app will probably make the app huge. That means it'll take a long time to install, and the app will use a lot of storage on the device. Every time you release a new version of the app, with more words, or even just to fix a few small bugs, the user will have to download all that data all over again.
Instead, you should consider building an app that can fetch the data it needs from a server. Ideally, you could apply that approach to all your app's data, not just the images. Maybe you'll organize your flash cards into sets of a few dozen, so that you can fetch a set of cards and the associated images pretty quickly, and sets that the user hasn't used for a while can be removed to free up space on the device. You'll be able to update a set of flash cards without having to update the app, and when you do update the app your users won't have to download all the data all over again.
You've said that you're a beginner, so this approach might seems very difficult. That's OK, you can start with a simpler approach and then improve as you go along. For example, you might just put all the images on a server and fetch them one at a time as you need them. Your flash card data file could contain just a dictionary with words and the URLs associated with those words. There are lots of examples of loading an image from an URL here on SO and elsewhere, so I'm not going to provide code for that, but it won't be hard to find. The earlier you start thinking about how to design your app so that it can scale as you add more and more words, the easier it will be to maintain the app later.
500 images can have a huge size. Applications that published on Appstore have size limit and Apple does not recommend to make big apps.
Store them on server and load needed images on fly. Also you will get possibility to update your images, remove add new.
If you don't have a backend, you can use something easy and free (Firebase storage for example) or with minimal code writing on AWS.
If you need to keep them on device - store them as files in the Documents or another apps folder, do not use CoreData for it (you can keep only the list of names/urls in database).
After loading image to be displayed for user, you can prefetch next bunch of images.
Use Alamofire, or SDWebImage to load images from network (I prefer last). These frameworks can do many useful things with images.
To load images:
you can have a list of your images (just list of the names and urls)
or
you can know only path and names pattern and generate links dynamically (like https://myserver/imageXXX.png.

Share Files between Apps on the same iPad (Without iCloud)

I have two iPad apps, one which downloads data from a server and stores it on the iPad and another one (the main app) which uses the data later.
(It would make sense to combine the two but it's a client requirement)
But I see no way to share the data between the two apps.
I have heard there are ways to do it using:
Custom URL Schemes
Document Support on iPad Devices
UIPasteboard
But I cannot find any thing explaining how to use any of these effectively.
Can anyone point me in the right direction.
Just to clarify:
It is an iPad only app
Both apps will not run at the same time
Basically I need to access the documents or caches folder of one app from another
Using iCloud or any other third part service is not possible
It would be great if I could make the downloader app into a sort of configuration page for the main app (if it is even possible)
So keeping these in mind which one would be the most suitable?
This link at github may be useful... Looks like someone has already made a file manager, using these elements you may be able to do what you are looking for. But as far as I know, your app is extremely sandboxed and does not really interact with other apps/the file system very much at all (Apple is very limiting that way)
EDIT
this post seems to have the explanations of local data sharing methods you were looking for. None of the methods in this post requires any connectivity, just a device and 2 apps :) Good luck!

Solutions for selecting and attaching images to models?

I'm trying to be lazy and would rather find an existing gem, plugin, etc. instead of writing my own implementation. The use case seems to me general enough that there may be something out there, but I can't find anything.
We're using Ruby on Rails and carrierwave to have users upload images that attach to so-called activities (which need to be curated several times a day). It turns out that users often (re-)use the same images for different activities. Instead of making the users upload the same image again all the time, I want to present them with a small gallery of images, and let them pick one to be used (or let them upload if they really want to, of course).
Is there something out there that would help me ?

Saving the Users Game Scores on iOS

I am developing an iOS game and I have two questions. First, I am maintaining the levels information (scores, background image, etc) into a plist file. The first time that the app is launched, I copy the plist file from the resources directory to the documents directory (I need to write the user best scores into it). Exits a best way to maintaing this information? Second, if I make an update of the app, adding new levels par example, how can I add the update new information without losing the current user scores?
Thanks for reading.
A property list seems as good a way to keep track of high scores and such as any other. If you've already got that working, stick with it until you have a good reason to change.
Your data file (indeed, the entire contents of the Documents directory) will be preserved when the user updates to a new version of the app.
AS Caleb said, a pList file is probably fine for saving high scores.
I'd like to add a bit about #2. You can just always re-use the same save file for simplicity, as long as you plan ahead for updates. This is a lot easier than trying to juggle different plist files for different versions.
When you create your game save plist file, just be sure to include a field for a save game format version number. That way, for future releases, you can open the save file, read the version number, and make any necessary adjustments to bring it up to the current version. This is extremely handy when players can essentially skip updates, downloading version 1 and 3 but skipping 2.
I agree with Caleb. It's best to have a little source code to help you.
I created this sample code that has both local and global support.
You might want to have a look at the NSUserDefaults class which provides basic management capabilities for storing app data. For more advanced data storage, CoreData is the recommended way to go.

Resources