Skip to content

Commit

Permalink
Update What's New
Browse files Browse the repository at this point in the history
  • Loading branch information
kaphacius committed Feb 28, 2024
1 parent ab1a05f commit 1ee1fc3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
47 changes: 36 additions & 11 deletions JustTags/Updates/WhatsNewVM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,39 @@ extension WhatsNewVM {
}
}

private static let versions: [String: WhatsNewVM] = [
"1.1.0": oneOne,
"1.2.0": oneTwo,
"1.2.2": oneTwoTwo,
"1.2.3": oneTwoThree
]

internal static let oneOne: WhatsNewVM = .init(
private static let versions: [String: WhatsNewVM] = .init(
uniqueKeysWithValues: Version.allCases.map { ($0.version, $0.vm) }
)

}

internal enum Version: CaseIterable {

case oneOne
case oneTwo
case oneTwoTwo
case oneTwoThree


internal var vm: WhatsNewVM {
switch self {
case .oneOne: Self.oneOneVM
case .oneTwo: Self.oneTwoVM
case .oneTwoTwo: Self.oneTwoTwoVM
case .oneTwoThree: Self.oneTwoThreeVM
}
}

internal var version: String {
switch self {
case .oneOne: "1.1.0"
case .oneTwo: "1.2.0"
case .oneTwoTwo: "1.2.2"
case .oneTwoThree: "1.2.3"
}
}

private static let oneOneVM: WhatsNewVM = .init(
version: "1.1.0",
items: [
.init(
Expand All @@ -67,7 +92,7 @@ extension WhatsNewVM {
]
)

internal static let oneTwo: WhatsNewVM = .init(
private static let oneTwoVM: WhatsNewVM = .init(
version: "1.2.0",
items: [
.init(
Expand All @@ -83,7 +108,7 @@ extension WhatsNewVM {
]
)

internal static let oneTwoTwo: WhatsNewVM = .init(
private static let oneTwoTwoVM: WhatsNewVM = .init(
version: "1.2.2",
items: [
.init(
Expand All @@ -99,7 +124,7 @@ extension WhatsNewVM {
]
)

internal static let oneTwoThree: WhatsNewVM = .init(
private static let oneTwoThreeVM: WhatsNewVM = .init(
version: "1.2.3",
items: [
.init(
Expand Down
4 changes: 2 additions & 2 deletions JustTags/Updates/WhatsNewView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ struct WhatsNewView: View {

struct WhatsNewView_Previews: PreviewProvider {
static var previews: some View {
WhatsNewView(vm: .oneOne)
WhatsNewView(vm: Version.oneOne.vm)
.frame(width: 500)
WhatsNewView(vm: .oneTwo)
WhatsNewView(vm: Version.oneTwo.vm)
.frame(width: 500)
}
}

0 comments on commit 1ee1fc3

Please sign in to comment.