A UIStackView Hack for Stacking Child Views Compactly

Before I developed for iOS, I did a lot of Microsoft WPF programming. One of the layouts available on that platform was a WrapPanel.

Microsoft’s WrapPanel is similar to Apple’s UIStackView in that it arranges child elements into a single line that can be oriented horizontally or vertically. There are many differences, but the one I want to focus on is that a WrapPanel will space the content as close together as possible, and the size of the content is determined by its intrinsic content size. Read more on A UIStackView Hack for Stacking Child Views Compactly…

UIStackView Tricks: Proportional Custom UIViews with ‘Fill Proportionally’

In iOS 9, Apple introduced a very handy new UI concept: the UIStackView. Stack views help us quickly compose sequential “stacks” of views without Auto Layout. UIStackView offers a number of distribution and spacing options in Interface Builder. If you’re unfamiliar with UIStackView, I recommend reading “Exploring UIStackView Distribution Types” first.

In this post, I’ll describe how to use the Fill Proportionally option with any custom view while enjoying fine-grained control over the proportions themselves. Read more on UIStackView Tricks: Proportional Custom UIViews with ‘Fill Proportionally’…

A Guide to Interacting with iBeacons in iOS using Swift

I’ve recently been working on an iOS project that uses iBeacons. In this post, I’ll provide a comprehensive guide for working with iBeacons in iOS using Swift. I’ll describe what iBeacons are, how you can use them, and what you should know about the programming model for interacting with them in iOS. I’ll also share some of the best practices that I learned.
Read more on A Guide to Interacting with iBeacons in iOS using Swift…

3 Good Habits for Avoiding Memory Leaks in Objective-C

I have been developing software in Objective-C for quite some time now, but I continue to discover new ways to shoot myself in the foot, particularly in the way of memory management. A while back, I wrote a post about finding iOS memory leaks using Xcode’s Instruments. This is a great tool for discovering memory leaks and tracking them down. But ideally, we would not have to deal with Objective-C memory leaks in the first place! The best way to avoid these types of problems is to stop them before they start.
Read more on 3 Good Habits for Avoiding Memory Leaks in Objective-C…

How to Remove Extra Separator Lines in a UITableView

When your UITableView does not have enough data to fill out the length of the screen, it will show empty cells with separators to fill out the screen. I have run into several situations where the extra separator lines are not wanted. If you have run into this yourself, then here is an easy trick to get rid of them that does not require any code. Read more on How to Remove Extra Separator Lines in a UITableView…

How to Use UISearchController to Add Search Your UITableViews

This is a simple tutorial on how to use the new UISearchController to add search capability to your UITableViews. The UISearchController was introduced a couple years ago in iOS 8 to replace the now deprecated UISearchDisplayController. In the new search controller, it is easier to add search to your table views. As of Xcode 8.1, the UISearchController has not been added to Interface Builder, so you have to add it programmatically. Even still, it is pretty easy to work with. Read more on How to Use UISearchController to Add Search Your UITableViews…

Working with iOS Image Filters in Swift

I have always found image processing interesting and fun. However, despite having a decent amount of experience with it, I had never worked much with the tools for iOS. I decided to play around with them a bit, and to my delight, most of the iOS image processing libraries are incredibly simple to use. This topic has a lot of surface area, so I won’t be able to do it justice in a single post. However, this post should be enough to allow you to get started with image processing in iOS.
Read more on Working with iOS Image Filters in Swift…

Auto Layout Demystified

I was at a local user group recently where the topic of the meeting was one of the hot new cross-platform mobile development options out there (doesn’t really matter which one). There was the usual UIkit bashing, which was expected since the topic was to propose an alternative programming model.

I’m not here to defend UIkit, because I agree that it can use some improvement. However, the speaker did say one thing about Auto Layout that I have heard before and that rubbed me the wrong way.
Read more on Auto Layout Demystified…

Sharing Web Data with iOS Using WKWebView

I recently helped develop a native iOS app for a client that sells software to many different educational organizations. We wrote the app in Swift, and it interacts with our client’s pre-existing web API.

One challenge we faced was that many of our client’s customers require single-account, multiple-login (SAML) support through their own web portals. To support SAML, we needed an easy way to pass a user’s API credentials from a web page to our iOS application. In this post, I’ll show how this can be accomplished using WKWebView.
Read more on Sharing Web Data with iOS Using WKWebView…