Skip to content

addTarget(), enumerate(), countElements(), find(), join(), stringByReplacingOccurrencesOfString(), property observers, range operators.

Notifications You must be signed in to change notification settings

jgon/hacking-with-swift-project-8-swifty-words

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Hacking with Swift - Project 8 - Swifty Words

Setup

  • Xcode 7.2.1
  • Swift 2.0
  • iOS 9.2
  • iPad

Topics covered

  • For loops with a condition: for ... in ... where.
  • Programmatically adding an action to a UIButton using addTarget and specifying the event .TouchUpInside.
  • Splitting a string into an array using String componentsSeparatedByString.
  • Using the enumerate to iterate over an array getting the position in the array as well as the array element (for (index, line) in lines.enumerate()).
  • Replacing occurrences of a string in a string using stringByReplacingOccurrencesOfString.
  • Trimming strings using stringByTrimmingCharactersInSet (whitespaceAndNewlineCharacterSet).
  • Looping over a range without including the upper bound of the range (for i in 0 ..< letterButtons.count). The ...operator includes the upper bound of the range.
  • Defining a property observer (didSet) to perform some logic every time the value changes. One can also use the willSet property observer to take action before the value is changed.

About

addTarget(), enumerate(), countElements(), find(), join(), stringByReplacingOccurrencesOfString(), property observers, range operators.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages