Files
dotdenote/assets/docker/notes/20240720T101500--ios-development-swift__programming_swift_ios.org
andros 000a24234c Add App Store screenshots, demo notes, and fix theme propagation
- 3 screenshots at 1284x2778 (iPhone 6.5"): note list, note detail, settings
- Docker WebDAV setup with 9 demo notes in Denote format for local screenshots
- Fix theme not applying to NoteListView and NoteEditorView: move tint/preferredColorScheme from App.body (Scene) to RootView.body (View) so @Observable tracking works correctly
- NoteEditorView (sheet) now also gets preferredColorScheme and tint directly
- Add debug.password UserDefaults fallback in DEBUG builds for screenshot automation
2026-05-26 11:45:47 +02:00

1.1 KiB

iOS Development with Swift

SwiftUI Essentials

State Management

  • @State — local, value-type state
  • @Binding — two-way connection to parent state
  • @Observable — reference type, iOS 17+
  • @EnvironmentObject — shared across view hierarchy

Navigation

NavigationStack {
    List(items) { item in
        NavigationLink(destination: DetailView(item: item)) {
            ItemRow(item: item)
        }
    }
}

Networking

Use async/await with URLSession:

func fetchData() async throws -> Data {
    let (data, response) = try await URLSession.shared.data(from: url)
    guard (response as? HTTPURLResponse)?.statusCode == 200 else {
        throw NetworkError.badStatus
    }
    return data
}

Keychain

Store sensitive data (tokens, passwords) in the iOS Keychain, never in UserDefaults.

Testing

  • Unit tests with XCTest
  • UI tests with XCUITest
  • Preview testing with #Preview