diff --git a/Demo/Demo.xcodeproj/xcuserdata/danielsaidi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Demo/Demo.xcodeproj/xcuserdata/danielsaidi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..d4585a9 --- /dev/null +++ b/Demo/Demo.xcodeproj/xcuserdata/danielsaidi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,6 @@ + + + diff --git a/Demo/Demo/Image+Demo.swift b/Demo/Demo/Image+Demo.swift new file mode 100644 index 0000000..c5fcebc --- /dev/null +++ b/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 } + ) + } +} diff --git a/Demo/Demo/Onboarding+Demo.swift b/Demo/Demo/Onboarding+Demo.swift new file mode 100644 index 0000000..e44c211 --- /dev/null +++ b/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") +} diff --git a/Demo/Demo/en.lproj/Localizable.strings b/Demo/Demo/en.lproj/Localizable.strings new file mode 100644 index 0000000..cf83bb5 --- /dev/null +++ b/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.";