At Tagged, we embrace open source as part of our engineering culture, always looking for ways to best support our own products while also sharing what we learn with the outside world.
Now, as we shift to a smartphone-oriented world, Tagged pivots its strategy to focus more on native mobile platforms. With this focus in mind, we are happy to introduce two of Tagged’s latest contributions to the open-source community: iOS-cat-scroller and iOS-voting-stack.
iOS-cat-scroller is also known as Continuous & AutomaTed scroll(able) controller. It is a subclass of NSObject that contains a UICollectionView with automatic view data binding so that users can simply instantiate a CatScroller object, which we’ll call CAT in this post.
Users can obtain a scrollable multi-column view by querying on the containerView property of CAT and adding it to the desired place. If a three-column view is needed, users would simply set CAT’s columnCount property to three. The entire layout would update accordingly.
One of the advantages of CatScroller compared to many other alternatives is that the internal view is a UICollectionView, which was introduced as part of iOS 6 and fully matured in iOS 7. Apple made several improvements and confirmed that it will continue to support UICollectionView, so we know that CatScroller will continue to deliver the best performance possible.
The iOS-voting-stack provides a view designed to encapsulate card-like voting selection behavior, made popular by apps like Tinder, Weotta and Tagged’s Swoon. The user can subscribe as a delegate to supply required information for view or listen to changes in the UI.
Using the voting stack is easy. You only need to implement five simple protocol methods:
- Number of items in the voting stack
- The view at a given index
- Number of selections in that index
- The degree for a given slice of selection for a given index
- Translate an “about to commit angle” to a corresponding selection
The encapsulated behavior makes it easy for the implementer to hide messy details and expose some amazing APIs for the iOS voting stack, such as programmatic or user-inputted pan/swipe behavior.
Yong Xin Dai is a Software Engineer Intern I on the iOS Mobile Team at Tagged.