Skip to content

Commit

Permalink
Update release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielsaidi committed May 28, 2024
1 parent 11e2237 commit e2fd2f3
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 40 deletions.
Binary file not shown.
1 change: 0 additions & 1 deletion Demo/Demo/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ struct ContentView: View {
NavigationStack {
List {
Section("Onboardings") {

listButton(
.popover,
presentPopover,
Expand Down
2 changes: 1 addition & 1 deletion Demo/Demo/DemoPageContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct DemoPageContent: View {

@Binding
var index: Int
let info: OnboardingPageInfo<LocalizedOnboardingFlow.Page>
let info: OnboardingPageInfo<LocalizedOnboarding.Page>

@Environment(\.dismiss)
private var dismiss
Expand Down
2 changes: 1 addition & 1 deletion Demo/Demo/DemoPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI

struct DemoPageView: View {

let onboarding: LocalizedOnboardingFlow
let onboarding: LocalizedOnboarding

@Binding var index: Int

Expand Down
2 changes: 1 addition & 1 deletion Demo/Demo/DemoSlideshow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI

struct DemoSlideshow: View {

let onboarding: LocalizedOnboardingFlow
let onboarding: LocalizedOnboarding

@Binding var index: Int

Expand Down
4 changes: 2 additions & 2 deletions Demo/Demo/Onboarding+Demo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ extension Onboarding {
static let demoToolbarPopover = Onboarding(id: "demo.toolbar.popover")
}

extension LocalizedOnboardingFlow {
extension LocalizedOnboarding {

static let demo = LocalizedOnboardingFlow(id: "demo-flow")
static let demo = .init(id: "demo-flow")
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ OnboardingKit is a Swift SDK that helps you create onboarding experiences in `Sw

OnboardingKit has different onboarding types. A standard ``Onboarding`` is shown right away, and only once, while other types can require multiple presentation attempts, a certain number of "incorrect" actions, etc.

OnboardingKit also has localized utilities, like the ``LocalizedOnboardingFlow``, and UI components like ``OnboardingPageView`` and ``OnboardingSlideshow``.
OnboardingKit also has localized utilities, like the ``LocalizedOnboarding``, and UI components like ``OnboardingPageView`` and ``OnboardingSlideshow``.



Expand Down
11 changes: 4 additions & 7 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ Breaking changes can still occur in minor updates, if there's a strong reason fo

## 8.0

This version adds support for strict concurrency and a new slideshow component.
This version adds support for strict concurrency and a new `OnboardingSlideshow` component.

### ✨ New features

* `OnboardingSlideshow` is a new view that automatically slides through a set of pages.
To simplify the `OnboardingPageView` and `OnboardingSlideshow` view builder setup, these functions have been refactored to only use `OnboardingPageInfo` as parameter.

### 💥 Breaking changes

* To simplify the OnboardingPageView and OnboardingSlideshow view builders, these functions have been refactored to only use the OnboardingPageInfo type as parameter. This is a breaking change, but it's very easy to fix. Sorry for any inconvenience.
### ✨ New features

* `OnboardingSlideshow` is a new view that automatically slides through a set of pages.



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ Both views can be styled by applying a style view modifier to the view hierarchy

## Localization

You can use a ``LocalizedOnboardingFlow`` to automatically generate onboarding pages from the localized strings in your project. This makes it easy to manage your onboarding flows with just text and assets, without writing more code.
You can use a ``LocalizedOnboarding`` to automatically generate pages from the localized strings in your project. This makes it easy to manage your onboarding with just text and assets, without writing any code.
7 changes: 2 additions & 5 deletions Sources/OnboardingKit/OnboardingKit.docc/OnboardingKit.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OnboardingKit is a Swift SDK that helps you create onboarding experiences in `Sw

OnboardingKit has different onboarding types. A standard ``Onboarding`` is shown right away, and only once, while other types can require multiple presentation attempts, a certain number of "incorrect" actions, etc.

OnboardingKit also has localized utilities, like the ``LocalizedOnboardingFlow``, and UI components like ``OnboardingPageView`` and ``OnboardingSlideshow``.
OnboardingKit also has localized utilities, like the ``LocalizedOnboarding``, and UI components like ``OnboardingPageView`` and ``OnboardingSlideshow``.



Expand Down Expand Up @@ -59,10 +59,7 @@ OnboardingKit is available under the MIT license.
- ``ConditionalOnboarding``
- ``CorrectBehaviorOnboarding``
- ``DelayedOnboarding``

### Localization

- ``LocalizedOnboardingFlow``
- ``LocalizedOnboarding``

### Views

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LocalizedOnboardingFlow.swift
// LocalizedOnboarding.swift
// OnboardingKit
//
// Created by Daniel Saidi on 2020-09-06.
Expand All @@ -8,11 +8,11 @@

import Foundation

/// This onboarding flow is generated by parsing information
/// from localized strings and mapping it to pages.
/// This onboarding is generated by parsing information from
/// localized strings and mapping it to pages.
///
/// With this approach, you can update an onboarding flow by
/// just adjusting localized strings and images.
/// With this approach, you can update an onboarding by just
/// adjusting localized strings and images.
///
/// The `pageResolver` starts at index 0 and will check if a
/// string exists for certain keys. As long as a page exists,
Expand All @@ -28,9 +28,9 @@ import Foundation
///
/// If you don't provide a `pageResolver`, the flow will use
/// ``page(for:at:in:resourceName:resourceKeySeparator:)``.
open class LocalizedOnboardingFlow {
open class LocalizedOnboarding {

/// Create a localized onboarding flow.
/// Create a localized onboarding.
///
/// - Parameters:
/// - id: The id to use.
Expand All @@ -44,9 +44,9 @@ open class LocalizedOnboardingFlow {
id: String,
bundle: Bundle = .main,
pageIndicationKey: String = "title",
resourceName: ResourceNameResolver = LocalizedOnboardingFlow.resourceName,
resourceName: ResourceNameResolver = LocalizedOnboarding.resourceName,
resourceKeySeparator: ResourceKeySeparator = ".",
pageResolver: @escaping PageResolver = LocalizedOnboardingFlow.page,
pageResolver: @escaping PageResolver = LocalizedOnboarding.page,
translator: Translator? = nil
) {
var index = 0
Expand Down Expand Up @@ -89,7 +89,6 @@ open class LocalizedOnboardingFlow {
/// The name of the image asset.
public let imageName: String?
}


public let pages: [Page]

Expand All @@ -102,7 +101,7 @@ open class LocalizedOnboardingFlow {
public typealias Translator = (String) -> String
}

public extension LocalizedOnboardingFlow {
public extension LocalizedOnboarding {

/// This function generates resource names, by using the
/// format `onboarding.<id>.<index>.<key>`.
Expand All @@ -124,7 +123,7 @@ public extension LocalizedOnboardingFlow {
for id: Onboarding.ID,
at pageIndex: PageIndex,
in bundle: Bundle,
resourceName: ResourceNameResolver = LocalizedOnboardingFlow.resourceName,
resourceName: ResourceNameResolver = LocalizedOnboarding.resourceName,
resourceKeySeparator: ResourceKeySeparator
) -> Page {
let separator = resourceKeySeparator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LocalizedOnboardingFlowTests.swift
// LocalizedOnboardingTests.swift
// OnboardingKitTests
//
// Created by Daniel Saidi on 2018-06-18.
Expand All @@ -9,14 +9,14 @@
import OnboardingKit
import XCTest

final class LocalizedOnboardingFlowTests: XCTestCase {
final class LocalizedOnboardingTests: XCTestCase {

func test_standardInitializer_createsStandardPagesForAllTranslations() {
let translator: (String) -> String = {
$0 == "onboarding.welcome.3.title" ? $0 : ""
}

let result = LocalizedOnboardingFlow(
let result = LocalizedOnboarding(
id: "welcome",
translator: translator)
let pages = result.pages
Expand All @@ -32,7 +32,7 @@ final class LocalizedOnboardingFlowTests: XCTestCase {
$0 == "onboarding_custom_2_movie" ? $0 : ""
}

let result = LocalizedOnboardingFlow(
let result = LocalizedOnboarding(
id: "custom",
pageIndicationKey: "movie",
resourceKeySeparator: "_",
Expand All @@ -45,7 +45,7 @@ final class LocalizedOnboardingFlowTests: XCTestCase {
}

func test_standardResourceNameResolver_usesExpectedResourceNameFormat() {
let result = LocalizedOnboardingFlow.resourceName(
let result = LocalizedOnboarding.resourceName(
for: "welcome",
at: 0,
key: "title",
Expand All @@ -54,7 +54,7 @@ final class LocalizedOnboardingFlowTests: XCTestCase {
}

func test_standardResourceNameResolver_omitsEmptyResourceKeys() {
let result = LocalizedOnboardingFlow.resourceName(
let result = LocalizedOnboarding.resourceName(
for: "farewell",
at: 3,
key: "",
Expand All @@ -63,11 +63,11 @@ final class LocalizedOnboardingFlowTests: XCTestCase {
}

func test_standardPageResolved_usesProvidedResourceNameResolved() {
let result = LocalizedOnboardingFlow.page(
let result = LocalizedOnboarding.page(
for: "hello",
at: 5,
in: .main,
resourceName: LocalizedOnboardingFlow.resourceName,
resourceName: LocalizedOnboarding.resourceName,
resourceKeySeparator: "_")
XCTAssertEqual(result.title, "onboarding_hello_5_title")
XCTAssertEqual(result.text, "onboarding_hello_5_text")
Expand Down

0 comments on commit e2fd2f3

Please sign in to comment.