Skip to content

Commit a70a810

Browse files
committed
Rename slide view types
1 parent 3547ec3 commit a70a810

File tree

7 files changed

+44
-18
lines changed

7 files changed

+44
-18
lines changed

RELEASE_NOTES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Release Notes
22

33

4+
## 6.1
5+
6+
### 🗑 Deprecations
7+
8+
* `TutorialSlideView` has been renamed to `TutorialPageView`.
9+
* `TutorialSlideViewStyle` has been renamed to `TutorialPageViewStyle`.
10+
11+
12+
413
## 6.0
514

615
Tutti is renamed to OnboardingKit.

Sources/OnboardingKit/OnboardingKit.docc/OnboardingKit.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ OnboardingKit is available under the MIT license.
7676

7777
### UI
7878

79-
- ``TutorialSlideView``
80-
- ``TutorialSlideViewStyle``
79+
- ``TutorialPageView``
80+
- ``TutorialPageViewStyle``

Sources/OnboardingKit/Tutorials/LocalizedTutorial.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ open class LocalizedTutorial: Tutorial<TutorialPage> {
5656
resourceName: ResourceNameResolver = LocalizedTutorial.resourceName,
5757
resourceKeySeparator: ResourceKeySeparator = ".",
5858
pageResolver: @escaping (TutorialId, PageIndex, ResourceNameResolver, ResourceKeySeparator) -> TutorialPage,
59-
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }) {
59+
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }
60+
) {
6061
var index = 0
6162
var pages = [TutorialPage]()
6263
var titleKey = resourceName(id, index, pageIndicationKey, resourceKeySeparator)
@@ -93,7 +94,8 @@ public extension LocalizedTutorial {
9394
pageIndicationKey: String = "title",
9495
resourceName: ResourceNameResolver = LocalizedTutorial.resourceName,
9596
resourceKeySeparator: ResourceKeySeparator = ".",
96-
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }) {
97+
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }
98+
) {
9799
self.init(
98100
id: id,
99101
pageIndicationKey: pageIndicationKey,
@@ -114,7 +116,8 @@ public extension LocalizedTutorial {
114116
for tutorialId: TutorialId,
115117
at pageIndex: PageIndex,
116118
resourceKey: ResourceKey,
117-
resourceKeySeparator: ResourceKeySeparator) -> ResourceName {
119+
resourceKeySeparator: ResourceKeySeparator
120+
) -> ResourceName {
118121
let key = resourceKey.trimmingCharacters(in: .whitespaces)
119122
var segments = ["tutorial", tutorialId, "\(pageIndex)"]
120123
if key.count > 0 { segments.append(key) }
@@ -129,7 +132,8 @@ public extension LocalizedTutorial {
129132
for tutorialId: TutorialId,
130133
at pageIndex: PageIndex,
131134
resourceName: ResourceNameResolver = LocalizedTutorial.resourceName,
132-
resourceKeySeparator: ResourceKeySeparator) -> TutorialPage {
135+
resourceKeySeparator: ResourceKeySeparator
136+
) -> TutorialPage {
133137
let separator = resourceKeySeparator
134138
let titleKey = resourceName(tutorialId, pageIndex, "title", separator)
135139
let title = NSLocalizedString(titleKey, comment: "")

Sources/OnboardingKit/Tutorials/TutorialPageInfo.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import Foundation
1010

1111
/**
1212
This type can be used to provide info about a tutorial page.
13+
14+
1315

1416
This struct can be used in various scenarios, to be able to
1517
extend the provided page information later without changing

Sources/OnboardingKit/UI/TutorialSlideView.swift renamed to Sources/OnboardingKit/UI/TutorialPageView.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// TutorialSlideView.swift
2+
// TutorialPageView.swift
33
// OnboardingKit
44
//
55
// Created by Daniel Saidi on 2022-09-04.
@@ -12,12 +12,12 @@ import UIKit
1212

1313
/**
1414
This view renders tutorial pages in a `TabView` with a page
15-
style applied, which lets the user swipe throught the pages.
15+
style applied, which lets the user swipe through pages.
1616

1717
This view is currently only available on `iOS`.
1818
*/
1919
@available(iOS 14.0, *)
20-
public struct TutorialSlideView<PageType: TutorialPage, PageViewType: View>: View {
20+
public struct TutorialPageView<PageType: TutorialPage, PageViewType: View>: View {
2121

2222
/**
2323
Create a tutorial page flow that renders tutorial pages
@@ -26,13 +26,13 @@ public struct TutorialSlideView<PageType: TutorialPage, PageViewType: View>: Vie
2626
- Parameters:
2727
- tutorial: The tutorial to present.
2828
- pageIndex: The current page.
29-
- style: The style to apply, by default ``TutorialSlideViewStyle/standard``.
29+
- style: The style to apply, by default ``TutorialPageViewStyle/standard``.
3030
- pageView: A function used to build a view for each page.
3131
*/
3232
public init(
3333
tutorial: Tutorial<PageType>,
3434
pageIndex: Binding<Int>,
35-
style: TutorialSlideViewStyle = .standard,
35+
style: TutorialPageViewStyle = .standard,
3636
@ViewBuilder pageView: @escaping PageViewBuilder
3737
) {
3838
self.tutorial = tutorial
@@ -65,7 +65,7 @@ public struct TutorialSlideView<PageType: TutorialPage, PageViewType: View>: Vie
6565
}
6666

6767
@available(iOS 15.0, *)
68-
struct TutorialSlideView_Previews: PreviewProvider {
68+
struct TutorialPageView_Previews: PreviewProvider {
6969

7070
struct Preview: View {
7171

@@ -83,7 +83,7 @@ struct TutorialSlideView_Previews: PreviewProvider {
8383
])
8484

8585
var body: some View {
86-
TutorialSlideView(
86+
TutorialPageView(
8787
tutorial: tutorial,
8888
pageIndex: $pageIndex
8989
) { page, info in

Sources/OnboardingKit/UI/TutorialSlideViewStyle.swift renamed to Sources/OnboardingKit/UI/TutorialPageViewStyle.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// TutorialSlideViewStyle.swift
2+
// TutorialPageViewStyle.swift
33
// OnboardingKit
44
//
55
// Created by Daniel Saidi on 2022-09-04.
@@ -9,11 +9,11 @@
99
import SwiftUI
1010

1111
/**
12-
This style can be used to style ``TutorialSlideView`` views
12+
This style can be used to style ``TutorialPageView`` views
1313
with custom colors.
1414
*/
1515
@available(iOS 13.0, *)
16-
public struct TutorialSlideViewStyle {
16+
public struct TutorialPageViewStyle {
1717

1818
/**
1919
Create a tutorial slide view style.
@@ -38,13 +38,13 @@ public struct TutorialSlideViewStyle {
3838
}
3939

4040
@available(iOS 13.0, *)
41-
public extension TutorialSlideViewStyle {
41+
public extension TutorialPageViewStyle {
4242

4343
/**
4444
This standard style applies a primary tint color to the
4545
indicators, with less opacity to non-current indicators.
4646
*/
47-
static var standard = TutorialSlideViewStyle(
47+
static var standard = TutorialPageViewStyle(
4848
pageIndicatorTintColor: .primary.opacity(0.3),
4949
currentPageIndicatorTintColor: .primary)
5050
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#if os(iOS)
2+
import Foundation
3+
4+
@available(iOS 14.0, *)
5+
@available(*, deprecated, renamed: "TutorialPageView")
6+
public typealias TutorialSlideView = TutorialPageView
7+
8+
@available(iOS 14.0, *)
9+
@available(*, deprecated, renamed: "TutorialPageViewStyle")
10+
public typealias TutorialSlideViewStyle = TutorialPageViewStyle
11+
#endif

0 commit comments

Comments
 (0)