Skip to content

p-larson/TCA-Bible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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