When building screens in an iOS app, a standard practice is build one viewController class per screen. What if the search and results page share a lot of code? What if they both contain an interactive header to select filter and sort options? What’s the best way to split this up?
Category Archives: Swift
Testing Tips and Resources
XCode is bundled with fairly sophisticated UI testing capabilities, but doesn’t provide the best documentation or most intuitive interface. Here, I’ll list a few tips that I’ve been saving and referencing when creating UI tests.
Continue readingClass bound protocol conformance
When using the delegate pattern to communicate between classes, standard practice is to do the following:
Continue readingInstalling CairoSVG to convert SVG to PDF
Designers often work with vector graphics, which are images that can be resized without any loss in quality. A common format for vector graphics is SVG.
iOS supports using vector graphics directly, but only in PDF format. Thankfully, there’s an easy way to convert SVG -> PDF using a free and open source tool like cairosvg. Blogger Rex Feng wrote an excellent how-to guide to convert and use vector graphics in XCode here:
Xcode’s Apple TV Simulators
Here’s a quick warning to tvOS devs: always test on a physical AppleTV. Xcode’s tvOS simulators are not always up to date.
Continue readingMaking an iOS 13 project work in iOS 12
When creating a new project in XCode 11.1, that project will only support iOS 13. This post will show how to add iOS 12 (and earlier) support.
Bug: UITabBarController Title Text ignored in iOS 13.1
I found a bug recently in how iOS 13.1renders the UITabBarController. Here’s a description of the issue and a workaround.
Demo project: https://github.com/UberNick/TabBarLabelBug/
Swift and iOS Interview Questions
A list of over 60 Swift and iOS questions asked during technical interviews.
Comments are welcome, including additional questions, alternative answers, and any corrections or clarifications.
Up-to-date for Swift 5.1
Swift and ObjC language
What’s Swift?
- A hybrid (function / object-oriented) modern language build to be concise and expressive
What’s Objective C?
Swift Cheatsheet
A list of helpful methods and syntax to reference before coding challenges and whiteboard interviews.
Download: SwiftCheatsheet.playground
Last update on 2020-09-22 for Swift 5.1
String
string.map { $0 } // Convert String to Character array
s[s.index(s.startIndex, offsetBy: i)] // Character at "i"
Continue reading