Singleton to Protocol
I was driving through the town of Singleton the other day and of course, it got me thinking about using singletons in my apps. Singletons were a commonly used pattern in Objective-C programming and appear in many of Apple’s own APIs, but seem to be increasingly frowned upon in the Swift world.
So what is a singleton? # A singleton is a class that only expects to have a single instance.
Three Rules for Writing Better Swift
- Do not use !.
- Use let, not var.
- Allow the compiler to infer types.
Read on for more details…
Configuring Xcode
While not strictly a part of my Learning Swift series, today I thought I would discuss some of the ways to configure and use Xcode to be a more productive and comfortable programmer.
1. Editor color themes and fonts: # Step through the supplied themes and find the best one for you. Then click the ‘+’ button at the bottom of the list and duplicate the selected theme. Now you can tweak it to suit you.
How do I start to learn Swift?
The first thing to do is to download the latest version of Apple’s Swift Programming Language book from the iBooks Store.
You can just read this book, especially the first section: “A Swift Tour”, but you will get more out of it if you follow along with the playground. There is a link to download the playground from the book which you can use directly if you are reading using iBooks on the Mac.
Icon Builder 3.2 Released
Icon Builder 3.2 is now available from the Mac App Store.
Icons for Apple Watch apps now have their alpha channel removed. Tidier folder structure for related files (iTunes Artwork files and Read Me). Updated to work with Xcode 7’s Assets.xcassets folders. Creates iPad Pro icons for Xcode 7.2 or later. Fix for Retina Macs creating double-sized images.
Why is Swift so great?
Firstly, I can give you the technical answer, as published by Apple:
Swift is a new programming language for iOS, OS X, watchOS, and tvOS apps that builds on the best of C and Objective-C, without the constraints of C compatibility. Swift adopts safe programming patterns and adds modern features to make programming easier, more flexible, and more fun. Swift’s clean slate, backed by the mature and much-loved Cocoa and Cocoa Touch frameworks, is an opportunity to reimagine how software development works.
Learning Swift - An Introduction
Welcome to Learning Swift. # This is the first post in what I hope will be an extensive series dealing with the Swift language. Here are some of the questions I hope to answer:
Should I learn Swift? Why? Why is Swift so great? How should I start learning Swift? I already know Objective-C - how do I convert? After that, I am planning a series of posts discussing the major differences of Swift from the view point of an Objective-C programmer and the aspects of Swift that I found difficult to grasp.
New Twitter account
I have started a new Twitter account so that I can provide rapid support to users of my apps. Please contact me @trozware if you have any questions, suggestions, bug reports or would just like to chat.
I will also be using this account to promote my new Learning Swift series.
Possible issues with Icon Builder & Watch icons
It has come to my attention that there are two possible issues with Icon Builder 3.0.1 when using icons created for an Apple Watch app. Once of them is something I can fix and the other appears to be a bug in Xcode 7.2
Update: Version 3.2 of Icon Builder is now available in the Mac App Store . This removes the alpha channel from icons for a watch app.
Man Reader 1.5
Man Reader has been updated to version 1.5 with a major improvement in the way it looks for available man pages.
Man Reader 1.5 is now available through the Mac App Store .
Change Log: # Much improved searching for available man pages. Sand-boxed version now works just as well as the non-sand-boxed. The main feature of this version is that it solves the previous problems with the App Store version and sand-boxing.