Skip to content

Commit

Permalink
Update demo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed Mar 11, 2024
1 parent 8e8cdc3 commit 2371ceb
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "E81C6B04-28C5-4BF6-8010-89D8EF8CC498"
type = "1"
version = "2.0">
</Bucket>
35 changes: 35 additions & 0 deletions Demo/Demo/Image+Demo.swift
@@ -0,0 +1,35 @@
//
// Image+Demo.swift
// Demo
//
// Created by Daniel Saidi on 2021-09-23.
// Copyright © 2021-2024 Daniel Saidi. All rights reserved.
//

import SwiftUI

extension Image {

static let popover = Image.symbol("bubble")

static var correctBehavior = Image(systemName: "hand.thumbsup.circle")
static var delayed = Image(systemName: "hand.raised.circle")
static var hint = Image(systemName: "heart.text.square")
static var incorrectBehavior = Image(systemName: "hand.thumbsdown.circle")
static var reset = Image(systemName: "multiply.circle")
static var tutorial = Image(systemName: "square.stack")
}

extension Image {

static func symbol(_ name: String) -> Image {
.init(systemName: name)
}

func label(_ text: String) -> some View {
Label(
title: { Text(text) },
icon: { self }
)
}
}
46 changes: 46 additions & 0 deletions Demo/Demo/Onboarding+Demo.swift
@@ -0,0 +1,46 @@
//
// Onboarding+Demo.swift
// Demo
//
// Created by Daniel Saidi on 2021-09-23.
// Copyright © 2021-2024 Daniel Saidi. All rights reserved.
//

import Foundation
import OnboardingKit

extension Onboarding {

static var demoOnboardings: [Onboarding] = [
demoListConditional(),
demoListCorrectBehavior,
demoListDelayed,
demoListPopover,
demoListSheet,
demoToolbarPopover
]

static func demoListConditional(
_ condition: @escaping () -> Bool = { true }
) -> ConditionalOnboarding {
.init(id: "demo.list.conditional", condition: condition)
}

static let demoListCorrectBehavior = CorrectBehaviorOnboarding(
id: "demo.list.correctbehavior",
requiredIncorrectAttempts: 3
)

static let demoListDelayed = DelayedOnboarding(
id: "demo.list.delayed",
requiredPresentationAttempts: 3
)

static let demoListPopover = Onboarding(id: "demo.list.popover")

static let demoListSheet = Onboarding(id: "demo.list.sheet")

static let demoToolbarPopover = Onboarding(id: "demo.toolbar.popover")

static let demoLocalizedFlow = LocalizedOnboardingFlow(id: "demo-flow")
}
14 changes: 14 additions & 0 deletions Demo/Demo/en.lproj/Localizable.strings
@@ -0,0 +1,14 @@
/*
Localizable.strings
OnboardingKit

Created by Daniel Saidi on 2021-09-23.
Copyright © 2024 Daniel Saidi. All rights reserved.
*/

"onboarding.demo-flow.0.title" = "Localized onboarding flows";
"onboarding.demo-flow.0.text" = "Localized flows resolve pages by parsing available localized strings.";
"onboarding.demo-flow.1.title" = "Automatic page count";
"onboarding.demo-flow.1.text" = "Just add or remove pages in Localizable.strings to update the flow.";
"onboarding.demo-flow.2.title" = "That's it";
"onboarding.demo-flow.2.text" = "These flows can be presented with the built-in OnboardingPageView and OnboardingSlideshow.";

0 comments on commit 2371ceb

Please sign in to comment.