My Books
-
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. Think of it as a global instance of a class. In some cases this makes perfect sense if there can only ever be one instance of a particular class or if there is a default variant that suits most cases e.g.
-
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. Each text category can have its own font and size, but you can make multiple selections in order to do a bulk change. don't forget to check out the Console section too - I dislike the default bold text for many of the console reports, so always change that.
-
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. If you are not, here is the download link.
You will also need to install Xcode from the Mac App Store. Xcode is Apple's IDE and is used for programming Mac, iPhones, iPads, Apple Watches and Apple TVs.
-
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.