It infers the type because of the function signature.Ĭlass RecipeIngredient : Food Q&A (24:05) Swift allows you to shorten the name to “.Normal” when you pass that value into a parameter. In this case, you could have an enum of type UIControlState with highlighted, normal, and different values associated with it. In Swift, you can add a dot before the last word. Value Types Using Enums (0:57)Įnums in Objective-C tend to have very long enum names, one example being UIControlStateNormal. This affects how these data structures are used in Swift. In Objective-C, these structures were classes. Structs in Swift include arrays, dictionaries, and strings. You can find a blog version of the talk (with code samples) below. In his SLUG presentation at ThoughtWorks, he covered a range of topics, including Swift data types and mutability of types, and converting Objective-C code into Swift.Īs usual, video & slides are synchronized. Soon after Swift came out David Kobilnyk set out on an interesting quest: to convert all the Objective-C code samples in the seminal book “ iOS Programming: The Big Nerd Ranch Guide” to Swift.
0 Comments
Leave a Reply. |