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
import Foundation
struct PadColumn: Identifiable, Codable, Equatable {
enum Detail: Codable, Equatable {
case post(String)
case profile(String)
case profileConnections(String, ProfileConnectionKind)
var title: String {
switch self {
case .post: return "Post"
case .profile: return "Profile"
case .profileConnections(_, let kind): return kind.title
}
}
}
let id: String
let title: String
let feed: CustomFeed?
let isNotifications: Bool
let detail: Detail?
static let following = PadColumn(id: "following", title: "Following", feed: nil, isNotifications: false)
static let notifications = PadColumn(id: "notifications", title: "Notifications", feed: nil, isNotifications: true)
init(id: String, title: String, feed: CustomFeed?, isNotifications: Bool, detail: Detail? = nil) {
self.id = id
self.title = title
self.feed = feed
self.isNotifications = isNotifications
self.detail = detail
}
init(feed: CustomFeed) {
self.init(id: feed.id, title: feed.name, feed: feed, isNotifications: false)
}
init(detail: Detail) {
self.init(
id: "detail-\(UUID().uuidString)", title: detail.title, feed: nil, isNotifications: false, detail: detail)
}
}