Implementing A Follow Button In Your Own App

Im planning on making a Social Media App In Swift and was wondering anyone knew how to implement a follow button for users to follow one another and how it would be possible to go about displaying said number of followers... All replies will be appreciated 🙂

Hi dylanh97,


The button that you wish to design is probably the final piece of your design question. I think what you're asking is how to build a "leader-follower" relationship between users in your app, and that's a whole software architecture problem involving choosing your data models ("user", with "followers" and "following" relationship properties, to start), and then your database technology (doable with CloudKit, by defining CKRecords that represent your data models). You can start by making a Core Data implementation of the models and relationships, and this will take care of your on-device storage of the social network.


Once you've set up all of that, then designing the button itself can be done with interface builder. Counting the number of followers will then be done by getting the count of "followers" for a given "user" object.


This is a very broad and non-specific answer to your question, because there's thousands of ways to implement this, but I'm sure there are free tutorials for how to make a "twitter-style" app, which should take you through the steps I described above (in exacting detail)

Implementing A Follow Button In Your Own App
 
 
Q