Create a Settings Bundle for iOS with Swift

Written on:August 6, 2014
Comments
Add One

Here are some quick little code tips for creating a settings bundle in Swift for iOS.

Settings are very easy to setup for iOS. Just note that the simulator currently does not work with settings correctly. The code in this post does work just fine on a device.

Load the Defaults into the Settings:

let appDefaults = [SettingsKeys.namePreferenceKey: "Default Name"]
NSUserDefaults.standardUserDefaults().registerDefaults(appDefaults)

Get the Settings value:

var namePreference = NSUserDefaults.standardUserDefaults().stringForKey(SettingsKeys.namePreferenceKey)

Save the Settings value:

NSUserDefaults.standardUserDefaults().setValue(namePreferenceField!.text, forKey:SettingsKeys.namePreferenceKey)
NSUserDefaults.standardUserDefaults().synchronize()

Here is the source code for this Swift project:
CreateSettings Xcode Project

Git Best Practices

Written on:July 30, 2014

Some questions have come up about using the master branch or a development branch. So I wanted to give my thoughts on the subject. The master branch is always used for current development of the next release. You can branch off to develop a new feature or fix an issue and then merge that back to master. When we do a major release you create a release branch from master….

Read more...

Date to Month, Day, Year in Swift

Written on:July 24, 2014

NSDate and NSCalendar is a bit different in Swift. Here is a little bit of code to help you extract the month, day, and year from the current date. let flags: NSCalendarUnit = .DayCalendarUnit | .MonthCalendarUnit | .YearCalendarUnit let date = NSDate() let components = NSCalendar.currentCalendar().components(flags, fromDate: date) let year = components.year println(year) let month = components.month println(month) let day = components.day println(day)

Read more...

UIColor extension for RGB Hex in Swift

Written on:July 22, 2014

We had a great boot camp this weekend at the Dallas iOS Swift Boot Camp! One question was how to make a UIColor from a hex value. I personally think hex colors are so much easier to deal with. Here is the little gem for you in swift: import UIKit extension UIColor {     class func colorWithRGBHex(hex: Int, alpha: Float = 1.0) -> UIColor {         let r = Float((hex >> 16)…

Read more...

iPhone / iPad App Development with iOS 8 in the Swift Programming Language

Written on:June 4, 2014

Apple just announced that they are moving to a new programming language called Swift. Swift is an innovative new programming language for Cocoa and Cocoa Touch. Stay ahead of your competition and learn Swift now! The three day intense hands on boot camp from 9am – 5pm covering the fundamentals and advanced features of iOS development in Swift. We will start from the ground up and teach you everything you…

Read more...

Scrum: a Breathtakingly Brief and Agile Introduction

Written on:May 14, 2013

I am reading this great little book about Scrum. It has some very good information and details to help you understand Scrum and Agile Development. It also is a great refresher to remind you about the important parts and definitions. It is very cheap and totally worth the cost. Check it out Scrum: a Breathtakingly Brief and Agile Introduction.

Read more...

Dallas iPhone / iPad Boot Camp

Written on:May 10, 2013

iPhone / iPad App Development with SDK 6.1 Friday, June 28, 2013 at 9:00 AM – Sun, June 30, 2013 at 5:00 PM (CDT) The three day intense hands on boot camp from 9am – 5pm covering the fundamentals and advanced features of iOS development. We will start from the ground up and teach you everything you will need to be able to develop your own iOS application and upload…

Read more...

DataInputStream for Objective-C

Written on:April 26, 2013

I have been playing around with writing a Mac OS X app for stock trading. I was granted access to the trade servers API of a major online broker. The stream server API uses a data byte stream to send chunks of data for quotes. I needed this to track the live trades in real time so my app could calculate if it should buy or sell. The problem was…

Read more...

Night & Day Magazine Jersey Shore

Written on:May 24, 2012

We have just finished and released a great new app for the Jersey Shore area! Check it out on iPhone and iPad: http://itunes.apple.com/us/app/night-day-magazine-jersey/id524384320?ls=1&mt=8 Check it out on Android: https://play.google.com/store/apps/details?id=com.ndmag.ndmag Looking for a place to eat or drink at the Jersey Shore? Want to find out what concerts or special events are happening at the Jersey Shore? Night&Day at the Jersey Shore gives you all the information you need! This is…

Read more...

Mission: Small Business Grant $250k

Written on:May 23, 2012

I am applying for a $250k grant from Chase and Livingsocial but to qualify I have to get 250 votes. It only takes a minute to vote for me. It uses facebook connect, so you just have to go to https://www.missionsmallbusiness.com and click “Log in & support”, then accept the fb connect link, and search for my company Apex Knowledge LLC, then click the vote button. Also, you get unlimited…

Read more...