Today we continue our journey through the most exciting open source projects for iOS. February surprised us with Objective-C taking the lead over Swift thanks to two significant releases.
Let’s look at these two surprising Objective-C releases plus two promising Swift releases:
Objective-C, ~6k stars this month
Visual feedback is crucial for every user interface, which is probably why an open source project that helps with creating animations has been leading on GitHub for two months in a row.
Lottie is a library that parses Adobe After Effects animations and renders them natively in Objective-C or React Native. You can import animations from JSON files or load them from a URL.Under the hood, Lottie uses NSJSONSerialization. Lottie’s approach to animations can probably be called data-driven: JSON data is parsed to models, or classes that describe parameters of Masks, Fills, Shapes, Paths, etc. that should be applied to a certain layer. While animations are running, all parameters of those models are set as real layer properties. Animations can be looped, resized, sped up, slowed down, and even interactively scrubbed.
When to use:
When developers want to implement animations exactly the way designers have imagined them.
Objective-C, ~2k stars this month
The LinkedIn team is famous for their 3x3 rule: Release three times per day with no more than three hours between the time code is committed and the time that code is available to team members.
It’s obvious that testing is the most important requisite for this approach. The quality assurance process should be quick, stable, and scalable. The problem is that testing processes can’t be quick and scalable when you need to run hundreds of UI tests but can only run one iOS simulator at a time.
Xctool is one possible solution to this problem – it provides an interface for parallelized test runs, but it’s no longer maintained. This is the reason why the LinkedIn team decided to develop their own tool for this purpose – Bluepill. Bluepill is written in Objective-C on top of the CoreSimulator framework. To comply with the 3x3 rule, Bluepill is highly optimized, combining tests with similar run times into groups and running tests in headless mode to reduce resource consumption. Bluepill generates reports in JUnit format, including all necessary statistics for each test run, and can be easily configured with a simple JSON file.
When to use:
When you have a lot of UI testing that you need to complete in a short amount of time.
Swift, ~1.5k stars in the past 2 weeks
There are a wide variety of approaches to adding custom effects for transitions between UICollectionView cells. The most common approach is to create a UICollectionViewFlowLayout subclass; this approach is implemented inside the AnimatedCollectionViewLayout. The main idea behind creating a UICollectionViewFlowLayout subclass is that every time the transformLayoutAttributes method of this subclass is called, this method asks the special object called animator (declared as a property) to perform the animation. There are 7 default types of animators: Parallax, ZoomInOut, RotateInOut, Cards, CrossFade, Cube, and Page. You can customize effects by changing an animator’s properties.
All animators implement the LayoutAttributesAnimator protocol with a single function – animate(collectionView: UICollectionView, attributes: PagerCollectionViewLayoutAttributes, position: CGFloat). This means you can add your own custom transition with ease by creating an animator class, implementing the LayoutAttributesAnimator protocol inside of it, and setting LayoutAttributesAnimator as a property of the AnimatedCollectionViewLayout instance.
When to use:
When you want to customize CollectionView transitions but still want to use your own UICollectionView and don't plan to change your UICollectionViewCell.
Swift, ~700 stars in the past 2 weeks
Dotzu is a handy debugging tool that provides crash reports, networking info, and cool logging features. To display logs, Dotzu overrides Swift’s print(). Dotzu also provides the ability to write all debug info to a specified file. The network logger implements URLProtocol and uses some dirty hacks like NSMutableURLRequest method swizzling :) Shoutout to Objective-C.
When to use:
When you want simple in-app debugging and need a tool that’s easy to integrate.
Check out our January digest for more libs. Stay tuned!