One of the really common layouts I have needed to implement with collection view is a simple flow layout but with fixed spacings. Apple provides us UICollectionViewFlowLayout, but the sad part is that it has dynamic spacing between items. Everything is there but not quite. Before UICollectionViewCompositionalLayout, one needs to create a subclass of the flow layout and then fixing spacings manually, which is pretty cumbersome to do. Therefore, let’s instead see what it takes to implement a simple self-sizing flow layout with fixed spacings when using UICollectionViewCompositionalLayout. The end… Read more Flow layout with self-sizing items and fixed spacing in UIKit →
I have numerous times needed to show some sort of collection view which adjusts its height based on the content. Most of the time it has been a dynamic list within some more complex scrollable UI. Therefore, in this post, we’ll take a look at how to set up a collection view which has its height set to the content height. On the screenshot below, we have a collection view with light grey background and two sections. The approach for making this working is pretty simple, which involves adding a… Read more Height fitting collection view →
I have been writing a new blog post at least every second week and therefore in 2020 I have published total of 27 blog posts. It is time to take… Read more Most visited blog posts in 2020 →
UILabel supports displaying attributed strings with link attributes but what it does not support is allowing to tap on hyperlinks and opening those in Safari. An Alternative way is using… Read more Opening hyperlinks in UILabel on iOS →
A SwiftUI view showing buttons for taking a photo and opening photo album.
Resizing images is an important topic when we need to display images which do not match with the intended display size. For example, rendering much large images in a small… Read more Resizing UIImages with aspect fill on iOS →
SwiftUI provides wrappers for UIViewController and UIView on iOS. Same wrappers are also available for AppKit views on macOS. Let’s see how to use those wrappers for rendering UIKit views… Read more Using SwiftUI previews for UIKit views →
iOS apps can add quick actions which are displayed when force touching on the app’s icon. We’ll add quick actions to my open source WaterMyPlants example app. Quick actions can… Read more Home screen dynamic quick actions on iOS →