Get user input in Swift

Here is a helper function that handles user input.¬†You can just plop all this in a file called¬†HelperFunctions.swift. /* This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, by Yong Bakos. */ import Foundation // Wait for the user to type something in the console, and return what // they type as… Continue reading Get user input in Swift

Published
Categorized as snippets Tagged

Display formatted date from DatePicker in iOS

If you have an NSDate object from a UIDatePicker and you want to display it formatted: let dateFormatter = NSDateFormatter() dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle myDateLabel.text = dateFormatter.stringFromDate(myDatePicker.date)