A natural place to start out with Swift and Xcode is to build Single View Applications. This is a great template that Xcode provides and is a great starting point for almost every project. But as you grow your applications you begin to need more than one screen or view and hence more than one view controller. Most applications, except the most basic, consist of more than one view controller and it is your job as an iOS developer to manage the communication between your multiple view controllers to create your app’s UX workflow. In this post I will cover how to add multiple view controllers to a Swift iOS app, how to transition from one view controller to another using navigation controllers and segues, and how to pass data from one view controller to another. Continue reading
Category Archives: Uncategorized
My 2015 MIT Computer Science Degree For Free
Recently, someone at work made a comment that has stuck with me for awhile. We were discussing some iOS apprenticeship I was planning on doing and he indicated that I don’t just like to learn but have an addiction to studying. I never thought about it quite like that but I had to agree that he was right. It is an addiction. In many ways though, with the changes in Computer Science, it is a great trait to possess in order to pursue perpetual learning. I think you absolutely need to love to learn in order to stay current in the industry.
It is with that in mind that I thought for 2015 I wanted to refresh my Computer Science knowledge, from the core, by taking the entire Junior and Senior year of courses from the MIT Undergraduate Bachelor of Science in Computer Science degree program which is all online on iTunes University and the MIT website thanks to the MIT Open Courseware. This includes video lectures, all the readings, and the same programming problem sets done by undergraduate MIT Computer Science majors. I could not think of a better way to become a better programmer.
Implementing Custom View Controller Transitions
Custom View Controller Transition animations were introduced in iOS7 and they provide you with the ability to customize every aspect of how view controllers animate between each other. This means you are no longer stuck with just the stock animations that are provided in Xcode and you can give your App its own unique feel.
How does it work?
Adapting AFNetworking to Swift
NSHipster, A.K.A. Mattt Thompson, returned to NY to announce Alamofire, adapting AFNetworking to Swift, and what Swift means to software design and open source. He had a long Q&A where he expressed the benefits of the Cathedral versus the Bazaar and where he admits its hard being the man.
I recorded the audio and used all the photos posted to Meetup and shot by Albert Tong to cut together the following presentation video (WWDC style).
The event was coordinated by Larry Legend as part of the New York iOS Developer Meetup.
WWDC14: The Ultimate Love Letter To Developers
This year’s weeklong Apple annual World-Wide Developer Conference (WWDC 2014 or WWDC14 or just dub-dub) has concluded. There are well over 100 videos, each an hour long, covering all the new updates to iOS and OS X now available at the developer portal. The first day, for the first time in its 25 year history, was live streamed in its entirety. The first day consists of the Keynote (open to all not just developers) and the remaining four days consists of developer-only content (the State of the Union and Apple Developer Awards or ADA round out the day one events). The remaining four days of content is composed of two types of events: Continue reading
Implementing Remote Notifications
In the previous article we walked through implementing a new iOS 7 multitasking feature called background app fetch which is great way for your app to get periodically launched in the background and update its content in order to keep the app fresh for a user – and the best part is its adaptive – meaning its based on when your user uses your application. If you haven’t had a chance to read that article I suggest you give it a look to see how you can build this feature into your app. In this article we will continue our exploration of new iOS 7 multitasking features with Remote Notifications which allows your app to launch immediately whenever you send it a special push notification – it can even launch your app in the background with a silent remote notification which will not bother the user.
How does it work? Continue reading
Implementing Background Fetch
Some of the apps I work on have periodic updates of information like news that I thought would benefit from new iOS 7 multitasking functionality. If I could update the app, I thought, while the user is not using the app then when the user opens the app the news will be fresh, new content will be available, and the user will feel no need to do a pull to refresh. Better yet if somehow I could predict when the user uses the app I could schedule the update just before they use it. Well, turns out iOS 7 introduced new background task handling that helps developers achieve this exact user experience. The functionality is called Background App Fetch.
How does it work you may be thinking. Continue reading
Implementing a Custom UIActionSheet
This week the need arose to have a more powerful UIActionSheet that went beyond having just buttons. My initial reaction was to simply subclass UIActionSheet and add whatever was needed. But an argument arose at to whether this was the best approach since Apple clearly indicates in the UIActionSheet Class Reference that
UIActionSheetis not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the
UIActionSheetAPI, you can create your own and present it modally with
Implementing Dynamic Type Support
iOS 7 introduced typographically heavy and complex designs that pushed solutions using string drawing and WebKit (both based on Core Graphics) to the limit. Going down to Core Text (an Advanced Unicode layout engine) may be overkill to simply render a label. Apple’s answer was Text Kit which is a fast, modern, object-oriented text layout and rendering engine which is built on Core Text and is tightly integrated with UIKit. In fact, all of Apple’s UI text-based controls like UILabel, UITextField, UITextView, and even UIWebView were rebuilt on top of Text Kit. This should provide seamless animations in UITableViews and even UICollectionViews.
This week I had the opportunity to get into Text Kit. The app I am working on has some views which are text heavy and to some have a small, hard to read, text. The answer was Text Kit’s Dynamic Type that provides designed type styles that are not only optimized for legibility but also user selectable through the Accessibility Settings on the iPhone. Getting this to work was easy and I started by building a prototype so as to know what I needed to add to the app. I’ll describe step-by-step what I did to build the prototype and although I have the prototype posted on GitHub I recommend you follow along step-by-step. Continue reading
View Controller With No NIB
On the whole, a view controller is created exactly like any other object. A view controller instance comes into existence because you instantiate a view controller class, either in code or by loading a nib / xib / storyboard. Beginners are taught to make Apps with Storyboard and that is great. Storyboards and Segues are an amazing addition to Interface Builder now all rolled into Xcode.
When working on a client with another developer there were times when we would have merge conflicts due to just even peeking at the Storyboard (which serves as a good reference and documentation for the project). Almost every check-in we had to double check and redo some small change and we were checking in often. There were only two of us so as the team grows these merge conflicts I can only imagine would grow. For the reason of multi-developer environments there are firms who do away with not just Storyboards but Nibs / Xibs in their entirety. I thought I’d create an App with a TableViewController that has no NIB as a reference for those who have never seen how this is done. This code is in Github. Continue reading