Create a Settings Bundle for iOS with Swift
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…
Read more...Date to Month, Day, Year in Swift
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...Tags:Apple , iOS , iOS 8 , Swift , Swift Programming Language , Xcode
UIColor extension for RGB Hex in Swift
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
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...Tags:Apple , Boot Camp , iOS , iOS 8 , iPad , iphone , iTunes , Programming , Swift , Swift Programming Language
Dallas iPhone / iPad Boot Camp
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
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...Tags:api , byte , code , DataInputStream , iOS , java , Mac OS X , objective-c , sample , stream
Understanding Apple iOS Push Notifications
Apple Push Notification Service (APNs) is a bit complex, but I will try to make it simple to understand from a business perspective. First you need to understand that when the notification is received on the device the operating system (OS) processes this data first and most of the time never calls your app code until you click the view button. The notification can contain a payload of data from…
Read more...Tags:APNs , Apple , iOS , notifications , payload , Push Notifications