Last active
June 15, 2023 07:41
-
-
Save ethanhuang13/6389106d2dcfe3cc00ac08fbb3293cd3 to your computer and use it in GitHub Desktop.
Xcode Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ViewBuilder | |
private func build<#name#>(_ viewStore: ViewStoreType) -> some View { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ViewBuilder | |
private var <#name#>: some View { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ComposableArchitecture | |
import SwiftUI | |
struct <#Name#>State: Equatable {} | |
enum <#Name#>Action: Equatable {} | |
struct <#Name#>Environment {} | |
extension <#Name#>Environment { | |
static var live = Self() | |
} | |
let <#Name#>Reducer = Reducer< | |
<#Name#>State, | |
<#Name#>Action, | |
<#Name#>Environment | |
> { state, action, environment in | |
.none | |
} | |
struct <#Name#>View: View { | |
typealias ViewStoreType = ViewStore<<#Name#>State, <#Name#>Action> | |
let store: Store<<#Name#>State, <#Name#>Action> | |
var body: some View { | |
WithViewStore(store) { viewStore in | |
} | |
} | |
} | |
#if DEBUG | |
struct <#Name#>View_Previews: PreviewProvider { | |
static var previews: some View { | |
NavigationView { | |
<#Name#>View(store: .init( | |
initialState: .init(), | |
reducer: <#Name#>Reducer, | |
environment: .live | |
)) | |
} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using Xcode Snippet to quickly add SwiftUI View with TCA. (It would be even faster if the placeholder can support multi-cursor editing.)
Setting Up

Profit
