Skip to content

Releases: ServerDriven/ScreenDataApp-ios

0.1.0

30 Apr 01:29
9ea8d6e
Compare
Choose a tag to compare

What's Changed

  • Update ScreenData and improve debugging mode by @0xLeif in #3

Full Changelog: 0.0.3...0.1.0

Visual Debugger Preview

03 Apr 01:08
10fe1ac
Compare
Choose a tag to compare
Pre-release

What's Changed

Full Changelog: 0.0.2...0.0.3

WatchOS Support Preview

31 Mar 01:49
263efea
Compare
Choose a tag to compare
Pre-release

What's Changed

New Contributors

  • @0xLeif made their first contribution in #1

Full Changelog: 0.0.1...0.0.2

Preview

30 Mar 01:18
Compare
Choose a tag to compare
Preview Pre-release
Pre-release

ScreenDataApp

Semi or Fully ServerDriven SwiftUI App using ScreenData

Usage

There are two different ways to make a ScreenDataApp

1) Use DefaultScreenDataApp

import ScreenData
import ScreenDataApp
import ScreenDataNavigation
import SwiftUI

@main
struct DemoScreenDataApp: App {
    let screenDataApp = DefaultScreenDataApp(
        baseID: "some id",
        screenProvider: MockScreenProvider(
            mockScreen: SomeScreen(
                title: "Hello Demo!",
                backgroundColor: SomeColor(red: 0.05, green: 0.6, blue: 0.1),
                someView: SomeLabel(
                    title: "Mock Screen",
                    font: .title
                )
                .someView
            )
        )
    )
    
    var body: some Scene { screenDataApp.body }
}

2) Conform the @main App to be a ScreenDataApp

import Chronicle
import ScreenData
import ScreenDataApp
import ScreenDataNavigation
import ScreenDataUI
import SwiftUI

@main
struct DemoScreenDataApp: ScreenDataApp {
    var chrono: Chronicle = DefaultScreenDataApp().chrono
    
    init() {
        configureScreenData()
    }
    
    var rootView: AnyView {
        AnyView(
            ProvidedSDScreen(baseID: "Anything...")
        )
    }
    
    func configureScreenProvider() -> ScreenProviding? {
        MockScreenProvider(
            mockScreen: SomeScreen(
                title: "Hello Demo!",
                backgroundColor: SomeColor(red: 0.05, green: 0.6, blue: 0.1),
                someView: SomeLabel(
                    title: "Mock Screen",
                    font: .title
                )
                .someView
            )
        )
    }
    
    func configureScreenStore() -> ScreenStoring? { nil }
    func configureCustomViews() -> [SDCustomizedView] { [] }
    func configureImageProvider() -> SDImageProviding { SDImageURLProvider() }
    func configureImageStore() -> SDImageStoring? { nil }
    func configureDefaultForegroundColor() -> Color? { nil }
    func configureButtonActions() -> [ScreenDataActionable] { [] }
    func configureFonts() -> ScreenDataFonts { ScreenDataFonts() }
}