Post

Replies

Boosts

Views

Activity

Reply to How to correctly pass NSFetchedResultsController's numberOfObjects from one VC to another?
Have you tried to simply pass the value when you push or present the VC2 view controller? For example in you VC2 declare a variable like this: class VC2: UIViewController { ... var numberOfObjects: Int = 0 ... } Then in you VC1, when you present or push the VC2 you should pass the value: let vc2 = <get your VC2 instance here> vc2.numberOfObjects = <your value here> <present or push your vc2 here>
Feb ’22
Reply to Calling an environment variable from a .xcconfig file in swift
You need first to add a variable inside your Info.plist, than you can read the variable from it. For example if you have a MyConfig.xcconfig file like this: MY_SECRET_API_KEY = mysupersecretapikeyvaluehere In your Info.plist you should add an entry like this: <key>MySecretApiKey</key> <string>$(MY_SECRET_API_KEY)</string> Finally in your code read the value of your variable like this: guard let infoDictionary: [String: Any] = Bundle.main.infoDictionary else { return } guard let mySecretApiKey: String = infoDictionary["MySecretApiKey"] as? String else { return } print("Here's your api key value -> \(mySecretApiKey)")
Feb ’22
Reply to Hi I'm new to coding and want to learn
I'm using the Apple M1 chip Mac with 256GB of storage and 8GB of memory for mobile development and I have no problems at the moment. I can keep several apps open, such as XCode, the simulator, some messaging apps, a music player, and a browser with many open tabs, and all of them work properly and smoothly as expected. So far I have occupied about 150GB of memory and I have already installed everything I need both for work and for extra-work. For the price it has I recommend it.
Feb ’22
Reply to What is the best way to save data on the device?
Hi allbdrii0, I think that the correct place to save data on device it strongly depends on a large set of variables like: the data type you're trying to save, the amount of data, the architecture of you're app, etc.... In general, I always use these rules to choose where I can store my data: Keychain: store all sensitive data (like passwords, secret tokens, coins amount, in-app purchase status, ...); UserDefaults: store only small amounts of not sensitive data (user preference like the app theme or the app language); CoreData: store large (or potentially large) amounts of data or store data that is queried/filtered often.
Feb ’22