Swiftpack.co - ServerDriven/ScreenDataApp-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ServerDriven.
ServerDriven/ScreenDataApp-ios 0.1.0
SwiftUI App for ScreenData
⭐️ 2
🕓 2 weeks ago
iOS watchOS linux macOS iOS
.package(url: "https://github.com/ServerDriven/ScreenDataApp-ios.git", from: "0.1.0")

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() }
}

GitHub

link
Stars: 2
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

0.1.0
2 weeks ago

What's Changed

Full Changelog: https://github.com/ServerDriven/ScreenDataApp-ios/compare/0.0.3...0.1.0

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics