Filters

Hide filters
Platform
Content Type
Difficulty

All Tutorials · 4 Results

Contained in: Swift Apprentice: Fundamentals patterns
iOS & Swift

Chapter in Swift Apprentice: Fundamentals

Regex

Searching for patterns in text is a common task you'll encounter in your programming travels. Swift provides a power type called Regex to perform that task. Using standard syntax, you can express complicated matching patterns to extract information from text. You can use an all-new regex builder syntax…
iOS & Swift

Chapter in Swift Apprentice: Fundamentals

Advanced Control Flow

…value and decide what to do based on that value, and they’re incredibly powerful when used with some advanced Swift features such as pattern matching. Countable Ranges Before you dive into the for loop statement, you need to know about the Countable Range data types that let you represent…
iOS & Swift

Chapter in Swift Apprentice: Fundamentals

Enumerations

…school year" } } Also, recall that switch statements must be exhaustive with their cases. The compiler will warn you if they aren’t. When case patterns are String elements, you need a default case because it’s impossible to create cases to match every possible String value. However, enumerations have…
iOS & Swift

Chapter in Swift Apprentice: Fundamentals

Properties

…circle.circumference // 31.42 // also, pi now has a value Since you’ve got eagle eyes, you’ve noticed that pi uses a { }() self-executing closure pattern to calculate its value, even though it’s a stored property. The trailing parentheses execute the code inside the closure curly braces immediately. But since…