Skip to content

joreilly/ConfettiSwiftUISPM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConfettiSwiftUISPM

Minimal version of Confetti i0S and macOS clients that consumes shared KMM code (from https://github.com/joreilly/Confetti) as a Swift Package. This uses the SwiftUI Multiplatform App template in XCode (supporting iOS and macOS) and uses same SwiftUI (and same package) for both. The shared code makes use of Decompose and the UI shows list of sessions for particular conference (based on observing UI state in SessionsComponent)

Screenshot 2023-06-17 at 16 52 05

Following is some of the SwiftUI used

struct SessionsListView: View {
    let component: SessionsComponent
    
    @StateValue
    private var uiState: SessionsUiState
    
    init(_ component: SessionsComponent) {
        self.component = component
        _uiState = StateValue(component.uiState)
    }

    var body: some View {
        switch uiState {
        case is SessionsUiStateLoading: ProgressView()
        case is SessionsUiStateError: ErrorView()
        case let state as SessionsUiStateSuccess: SessionsContentView(component: component, sessionUiState: state)
        default: EmptyView()
        }
    }
}

About

Minimal version of Confetti i0S clients that consumes shared KMM code as Swift Package

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages