The following apps demo Swift, as well as the expanded capabilities of Xcode 11
- Uses SwiftUI w/UIKit
- SwiftUI on macOS and iPadOS
- Swift Packages of the game thus far
- SwiftUI demo app
- Original app's capabilities then expanded upon
- Uses UIKit w/SwiftUI
- SwiftUI on AppleTV
- Declarative app development
- declare how views should look and what data they depend on
- declare how view's state affects its appearance & how SwiftUI should react to change in data dependencies
- Essentially a reactive UI
- Help speed up app development
- Views
- Declarative UI doesn't need stringly-typed identifiers to stay in sync with code
- use views 4 layout and navigation and encapsulate presentation logic for a specific piece of data
- API consistent across platforms
- Controls describe their role not appearance - same control looks appropriate for every platform
- Data
- Declarative data dependencies update views upon data change - the framework recomputes the views and all their children, then renders what has changed
- View's state depends on its data => declare how view uses data, how view reacts to data changes, or how data affects the view
- Declare possible states for view and how view appears in each state
- Navigation
- Conditional subviews can replace navigation
- Integration
- Easy to integrate SwiftUI into UIKit app and vice versa
- SwiftUI manages dependencies to keep views consistent with their state => don't have to worry about doing things in the right order or forgetting to update a UI object
- Canvas means no need for storyboard
- Subviews keep selves updated means no need for view controller
- Live preview means not as much a need for simulator
- Views
-
Adaptive Layout
-
Adaptive Font
-
Device-Dependent Images (Including Retina HD images for iPhone 6 Plus)
- Username & Password storage and retrieval
-
Measuring incoming audio levels using AVAudioSession while simultaneously drawing a waveform using EZAudio
- A tutorial explaining the previous will be available at techEd
- LIFO
- Essential operations
- push
- pop
- Linear & unidirectional
- O(1) time complexity for head-first insertion (Arrays have O(n) time complexity for head-first insertions)
- Conforming to collection protocols, Sequence and Collection, affords host of methods for fairly small set of requirements
- Copy-on-write (value semantics)
- FIFO
- Enqueue inserts at end of queue
- Dequeue removes from front of queue
- Elements not stored in contiguous memory blocks like Array. This scattered storage has potential for cache misses.
- Ring-buffer-queue good for queues of fixed size
- Leveraging two stacks improves
dequeue(_:)
time complexity to amortized O(1) - Double-stack beats out Linked List in spacial locality