-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathFirstOpenScreen.swift
57 lines (54 loc) · 2.33 KB
/
FirstOpenScreen.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import Foundation
import UIKit
import WhatsNewKit
struct FirstOpenScreenProvider {
func build(onDismiss: (() -> Void)? = nil) -> UIViewController {
let readingList = "Reading List"
let title = "Welcome to \(readingList)"
let whatsNew = WhatsNew(title: title, items: [
WhatsNew.Item(
title: "Track Your Reading",
subtitle: "Easily record the start and finish dates of every book you read",
image: UIImage(largeSystemImageNamed: "calendar")
),
WhatsNew.Item(
title: "Easily Add Books",
subtitle: "Add your books by scanning a barcode, or by searching online",
image: UIImage(largeSystemImageNamed: "magnifyingglass")
),
WhatsNew.Item(
title: "Write Notes",
subtitle: "Add star ratings and notes to your books",
image: UIImage(largeSystemImageNamed: "star.fill")
),
WhatsNew.Item(
title: "Organise Your Books",
subtitle: "Create your own lists to organise your library",
image: UIImage(largeSystemImageNamed: "tray.full")
),
WhatsNew.Item(
title: "Privacy Focused",
subtitle: "All data is kept fully private",
image: UIImage(largeSystemImageNamed: "lock.fill")
)
])
var config = WhatsNewViewController.Configuration()
config.itemsView.imageSize = .fixed(height: 40)
if let startIndex = title.startIndex(ofFirstSubstring: readingList) {
config.titleView.secondaryColor = .init(startIndex: startIndex, length: readingList.count, color: .systemBlue)
} else {
assertionFailure("Could not find title substring")
}
config.detailButton = WhatsNewViewController.DetailButton(
title: "Learn more",
action: .website(url: "https://readinglist.app/about")
)
config.completionButton = WhatsNewViewController.CompletionButton(
title: "Continue",
action: .custom { controller in
controller.dismiss(animated: true, completion: onDismiss)
}
)
return WhatsNewViewController(whatsNew: whatsNew, configuration: config)
}
}