SwiftGuru
SwiftGuru copied to clipboard
Advanced Swift Workshop try! Swift @Bangalore
Purpose: The workshop is designed for software developers with prior experience in Swift
. The outcome of this workshop is to help the participants familiarize with the advanced features and syntax of the Swift Programming Langauge by learning its rather unique approaches to solve design problems such as protocol-oriented, value-oriented, and functional programming.
Session 1: Functional Swift
1.1 Immutability and Pure Functions
Fundamentals of Functional Programming. Learn about the merits of immutability, pure and impure functions. In Swift, functions can be stored, passed as arguments, returned from other functions - they first class
citizens!
1.2 Closures
Closures are anonymous functions. Their contribution to the "high expressiveness" is tremendous. They make code concise and readable at the same time!
1.3 Higher-order Functions
Functions that accept or return other functions are called higher order functions
. The legendary map
, filter
, reduce
and flatMap
.
1.4 Higher-order Functions
Function composition make code readable and modular.
Session 2: Custom Operators
Swift is designed to be a highly expressive language. Support for custom operators on custom types works wonders in this direction. Swift actually allows you to define your own domain specific language by letting you define different kinds of operators and set the precedences.
Session 3: Protocols And Generics
Protocols is one of the cornerstones of Swift. Generics, in themselves, like those of any other language, are a crucial construct when it comes to writing the standard library. The primary application of generics is with protocols. In this session we'd also touch upon protocol oriented programming, associated types and type erasure.
Session 4: Sequences and Collections
Collections form the backbone of any langauge's standard library. Sequences and different kinds Collections in Swift are defined as protocols. The conformance rules to every protocol are very clearly stated. Conforming to any of the Collection protocol gives in return, a lot of functionality, making the API usage a great experience. Get hands-on to see how conformance to different protocols enriches your experience.
Session 5: Value, References, Indirection And Copy On Write
What's better - class
or struct
? Though many are heard advocating "programming with values", a programmer needs to appreciate the meaning of values
and references
to make some decision and how to make reference types have value semantics.
Session 6: Enums, Pattern Matching and Error Handling
In simple words, enums are types with a limited set of values. The values in turn, may have associated values. Pattern matching is typically done using the switch
statement. The powers of enums
and pattern matching
can be realized only by using to together. One of the use cases of enums and pattern matching is error handling
.
Session 7: Memory Management
Learn how to access memory directly from the unsafe swift API
Backup Topics
We'll deal with these only if there's time left after covering all of the above.
Codable and JSON
Introduced in Swift 4, the Codable interface along with the JSON encoding and decoding support, makes encoding to JSON and decoding out of JSON very easy.
KeyPaths
Discussed scantily for now, KeyPaths are quite a powerful construct introduced in Swift 4. They let you create a property reference into a deeply nested structure, allowing you to access and modify properties by the reference as an index.