Caching likes a follow state iOS swift - ios

I'm building a small social network. I quite far already. But now I need to implement a caching system.
In my app I can like things and follow other peoples. So what I want:
When I like a recipe it automatically counts up the number of likes. In the whole app without to reload a page
When I follow someone the it aitmomatically counts up the number of followers. In the whole app aswell without reloading anything.
Does anybody have an idea how to do this?
I'm working with swift.
Thank you :D

If you need an in-memory cache try the following library:
http://realm.io
If you need some kind of persistent database here are some options:
YapDatabase (key-value SQLite wrapper)
Realm.io (it fits for such purposes too)
Core Data (seems that it is too complicated solution for your issue)

This might help to you in caching, which code has written in swift. Code is here!

Related

Sync Core Data across Devices

Hey at the moment I'm learning Swift and started to create an App for that. Everything is fine and I think I know the basics now. In that App, I use CoreData to save my Data but I would like to Sync that across Devices
Is there a way with Icloud to do that, I found there is something called "Core Data Ensembles" But is there a better way, or should I use the IcloudKit, if I can do the same things in IcloudKit with the relations like in coreData.
I just found old posts about that, so maybe there is a better way to do this.
Thanks in advance
Such synchronization works without any libraries involved. The main trick here is to place SQL file (or whatever you use for storing data) into a special folder that is going to be synced, so-called ubiquity container, and specify path to it for your persistent store coordinator. Here you can check high-level description of how it works, and there are a lot of step-by-step tutorials about it, e.g. here.

Automatically create firebase record from RSS feeds - feedthefire

I am working on a RSS based mobile app. However, all of the posts need to come from Firebase because there is metadata associated with them (likes etc..).
Originally I was thinking of using FeedKit (a RSS library for iOS) so that in the background every time a user is using the app, I'll push any new RSS items to Firebase. This seems like a very inelegant solution however.
I've been looking around for other ways to automate this on the web. One solution is to use Zapier: https://zapier.com/zapbook/zaps/3282/add-new-rss-by-zapier-feed-items-to-firebase-as-new-records/.
But with the amount of authors in our app this would be way too expensive.
Then I came across a library called FeedTheFire: https://github.com/katowulf/feedthefire
I would love to use this, it seems like a perfect solution. However I only have experience with Swift & iOS development, and have no idea how I would go about implementing this library.
If someone could give me a high-level idea of what would be involved with setting this up, that would be amazing. Keep in mind I have never worked in any other language than Swift, except basic front end web.
I'm not looking for anything specific, I'm sure I can hack up a solution. I just need a better idea of what that solution would actually look like.

Xcode 8/Swift 3: make API information available offline? [duplicate]

This question already has an answer here:
How to make offline database for my app?
(1 answer)
Closed 6 years ago.
I'm currently working on an application in Xcode 8/Swift 3 which runs through APIs. Essentially, I'm parsing information using SwiftyJSON from my MySQL database which keeps the content current and easily updated.
To keep it so the content is also available offline, I'd like to introduce a facility where the data is downloaded and stored on the phone so it is available in "offline mode".
I know it's a completely open question but can anyone point me in the correct direction of how I could make this JSON information available offline? I've tried searching the net with no success.
I know it's not Swift, but the absolute master of this has recently open sauced his master piece: Dash for iOS.
Reviewing what he's done to get rapid scrolling and searches might give some deep insight into how to best do this as done by someone with (arguably) more experience in this area than anyone other than Apple:
https://github.com/Kapeli/Dash-iOS
I will prefer here 2 option either I will go with 1.SQLite DB or 2. NSURLCache
For SQLite DB you can use FMDB wrapper-https://github.com/ccgus/fmdb
For NSURLCache check this link Best way to Cache JSON from API in SWIFT?
If you just want to save json then go with NSURLCache for offline mode.
Achieving offline for iOS is having two best paths they are CoreData and SQLITE. As per the definition of CoreData suggests it is a Model layer of the project. It comes with less efforts on developer side. Bit contrast SQLITE having the same way but little efforts on it.
In my project we are using the CoreData for offline maintenance. Really we have few concerns on the Relational data fetching, Although there is a Predicates representing CoreData for the same still it is limited to some part. These type of situations SQLITE is really a life saver. We can easily fetch the records with simple JOIN commands.
Conclusion:
If you have more complex data relations it's really better to go with the SQLITE, Apart from CoreData is best choice.

Reasons to use CoreData rather than just fetching the data with a get request and saving it in a local variable

I'm working on a new iOS app and I keep reading things online such as, "All apps that use backends should use CoreData". I haven't been able to find to many reasons backing up this logic. Are there any reasons that I am not realizing for why I should use CoreData in an application if the content is constantly changing and I don't need to sort or access the data offline? I have gotten CoreData to work, I just don't fully see the benefit be is ease or performance. Would anyone mind shedding some light on this topic?
You don't have to use it.
Some reasons you might use it in the case you've described:
If you have a lot of data, too much to keep in memory on the device
If you want undo–redo support
You want support for fancy querying

Design pattern for Core Data default entries

I'm planning a new ios app and am not sure of what is the best way to set up a start list for a tableView on first app start. The app uses Core Data (more precisely Magical Record). Should I use some kind of (p)list (dictionary) which gets imported or should I just hard code the default entries like when the user adds something through a formula? Thank you!
There are a load of arguments for and against all different ways of doing this.
Personally I prefer just to hard code all the default entries (if there aren't thousands of them obviously).

Resources