Skip to content

Commit 1f18330

Browse files
committed
Make Tutorial non-generic
1 parent eb02d2f commit 1f18330

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ If you need the removed `UIKit` parts, you can grab them from the `3.1.1` releas
1515

1616
### 💥 Breaking changes
1717

18+
* `Tutorial` is no longer generic.
1819
* The `UIKit` folder has been removed in this version.
1920

2021

Sources/Tutti/Tutorials/LocalizedTutorial.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import Foundation
4040
`resourceNameResolver`. It also applies the "resource name"
4141
for `image` as `imageName` for each page.
4242
*/
43-
open class LocalizedTutorial<Page: TutorialPage>: Tutorial<Page> {
43+
open class LocalizedTutorial: Tutorial {
4444

4545
/**
4646
Create a tutorial by automatically creating pages based
@@ -55,10 +55,10 @@ open class LocalizedTutorial<Page: TutorialPage>: Tutorial<Page> {
5555
pageIndicationKey: String = "title",
5656
resourceName: ResourceNameResolver = LocalizedTutorial.resourceName,
5757
resourceKeySeparator: ResourceKeySeparator = ".",
58-
pageResolver: @escaping (TutorialId, PageIndex, ResourceNameResolver, ResourceKeySeparator) -> Page,
58+
pageResolver: @escaping (TutorialId, PageIndex, ResourceNameResolver, ResourceKeySeparator) -> TutorialPage,
5959
translator: @escaping Translator = { NSLocalizedString($0, comment: "") }) {
6060
var index = 0
61-
var pages = [Page]()
61+
var pages = [TutorialPage]()
6262
var titleKey = resourceName(id, index, pageIndicationKey, resourceKeySeparator)
6363
while titleKey != translator(titleKey) {
6464
let page = pageResolver(id, index, resourceName, resourceKeySeparator)
@@ -78,7 +78,7 @@ open class LocalizedTutorial<Page: TutorialPage>: Tutorial<Page> {
7878
public typealias TutorialId = String
7979
}
8080

81-
public extension LocalizedTutorial where Page == TutorialPage {
81+
public extension LocalizedTutorial {
8282

8383
/**
8484
Create a tutorial by automatically creating pages based

Sources/Tutti/Tutorials/Tutorial.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ import Foundation
1212
A tutorial is a single or multi-page onboarding guide, that
1313
is intended to show more information than short a hint.
1414
*/
15-
open class Tutorial<Page: TutorialPage> {
15+
open class Tutorial {
1616

1717
/**
1818
Create a tutorial with a fixed set of pages.
1919
*/
20-
public init(pages: [Page]) {
20+
public init(pages: [TutorialPage]) {
2121
self.pages = pages
2222
}
2323

24-
public let pages: [Page]
24+
public let pages: [TutorialPage]
2525
}

0 commit comments

Comments
 (0)