p-larson / TCA-Bible

Bible reader built with SwiftUI & TCA

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TCA-Bible

Swift

This project is solely a demonstration of a multiplatform iOS/macOS application built with SwiftUI and TCA. Both apps are distinct, but they do share a majority of their code-base. Using TCA to hyper-modularize this project has allowed the two targets to share the most feasible amount of depenedencies, which has been a huge advantage.

iOS

Mac

Source

Tests

More

My favorite lines of code from this project ๐Ÿ’–

Exhaustive testing with TCA

// BibleCore/Tests/ReaderCoreTests/ReaderTests.swift#testNextChapter:82-84
await store.send(.menuDirectory(.book(id: Book.genesis.id, action: .select(.genesis, .mock, .mock, nil)))) {
    $0.isDirectoryOpen = false
}

My least favorite lines of code from this project ๐Ÿ˜ช

Optional SwiftUI.View#tag

// BibleCore/Source/DirectoryCore/ToolbarDirectory/ToolbarDirectoy.swift:23
// viewStore.$book: Optional<Book>
Picker(selection: viewStore.$book) { 
  ForEach(books) { book in
      Text(book.name)
        // This is beyond the silliest part of SwiftUI.
        // BindingState<Optional<Book>> requires tag to SwiftUI.View#tag to be Optional<Book>
        // otherwise, Optional<Book> equate to Book will always fail.
        .tag(Book?.some(book))
  }
}
...

Screenshot Screenshot 2

About

Bible reader built with SwiftUI & TCA


Languages

Language:Swift 100.0%