Skip to content

Commit 3b7cb2d

Browse files
committed
Cleanup.
1 parent 7013368 commit 3b7cb2d

19 files changed

+83
-150
lines changed
21.6 KB
Loading
1.74 KB
Loading

Examples/DiffableTextAppXUIKit/App/Observables/Observable.swift renamed to Examples/DiffableTextAppXUIKit/App/Models.Observables/Observable.swift

File renamed without changes.

Examples/DiffableTextAppXUIKit/App/Observables/ObservableIntegerIntervalAsBounds.swift renamed to Examples/DiffableTextAppXUIKit/App/Models.Observables/ObservableIntegerIntervalAsBounds.swift

File renamed without changes.

Examples/DiffableTextAppXUIKit/App/Observables/ObservableTwinValues.swift renamed to Examples/DiffableTextAppXUIKit/App/Models.Observables/ObservableTwinValues.swift

File renamed without changes.

Examples/DiffableTextAppXUIKit/App/Screens.Number/NumberScreen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ struct NumberScreen: View {
2929
var body: some View {
3030
Screen {
3131
Scroller {
32-
Segments(context.format.xwrapped)
32+
Segments(context.optionality.xwrapped)
3333

34-
NumberScreenOptionalToggle(context.optional)
34+
Segments(context.format.xwrapped)
3535

3636
NumberScreenOptionsWheel(context)
3737

Examples/DiffableTextAppXUIKit/App/Screens.Number/NumberScreenContext.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ final class NumberScreenContext: ObservableObject {
2020
// MARK: State
2121
//=------------------------------------------------------------------------=
2222

23-
let decimals = ObservableTwinValues(Decimal(string: "1234567.89")!)
24-
let optional = Observable(false)
23+
let decimals = ObservableTwinValues(Decimal(string: "1234567.89")!)
24+
let optionality = Observable(OptionalityID.standard)
2525

2626
let format = Observable(FormatID.currency)
2727
let locale = Observable(Locale(identifier: "en_US"))
@@ -40,5 +40,11 @@ final class NumberScreenContext: ObservableObject {
4040
// MARK: Declaration
4141
//*========================================================================*
4242

43-
enum FormatID: String, CaseIterable { case number, currency, percent }
43+
enum FormatID: String, CaseIterable {
44+
case number, currency, percent
45+
}
46+
47+
enum OptionalityID: String, CaseIterable {
48+
case standard, optional
49+
}
4450
}

Examples/DiffableTextAppXUIKit/App/Screens.Number/NumberScreenExampleViews.swift

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,43 @@ import DiffableTextViews
1818
struct NumberScreenExample: View {
1919
typealias Context = NumberScreenContext
2020
typealias FormatID = Context.FormatID
21+
typealias OptionalityID = Context.OptionalityID
2122

2223
//=------------------------------------------------------------------------=
2324
// MARK: State
2425
//=------------------------------------------------------------------------=
2526

2627
let context: Context
2728

28-
@ObservedObject var optional: Observable<Bool>
29-
@ObservedObject var format: Observable<FormatID>
3029
@ObservedObject var locale: Observable<Locale>
3130
@ObservedObject var currency: Observable<String>
31+
@ObservedObject var format: Observable<FormatID>
32+
@ObservedObject var optionality: Observable<OptionalityID>
3233

3334
//=------------------------------------------------------------------------=
3435
// MARK: Initializers
3536
//=------------------------------------------------------------------------=
3637

37-
@inlinable init( _ context: Context) {
38-
self.context = context
39-
self.optional = context.optional
40-
self.format = context.format
41-
self.locale = context.locale
38+
@inlinable init( _ context: Context) {
39+
self.context = context
40+
self.locale = context.locale
4241
self.currency = context.currency
42+
self.format = context.format
43+
self.optionality = context.optionality
4344
}
4445

4546
//=------------------------------------------------------------------------=
4647
// MARK: Body
4748
//=------------------------------------------------------------------------=
4849

4950
var body: some View {
50-
switch (optional.wrapped, format.wrapped) {
51-
case (false, .number): decimalStandardNumberView
52-
case (false, .currency): decimalStandardCurrencyView
53-
case (false, .percent): decimalStandardPercentView
54-
case (true, .number): decimalOptionalNumberView
55-
case (true, .currency): decimalOptionalCurrencyView
56-
case (true, .percent): decimalOptionalPercentView
51+
switch (optionality.wrapped, format.wrapped) {
52+
case (.standard, .number): decimalStandardNumberView
53+
case (.standard, .currency): decimalStandardCurrencyView
54+
case (.standard, .percent): decimalStandardPercentView
55+
case (.optional, .number): decimalOptionalNumberView
56+
case (.optional, .currency): decimalOptionalCurrencyView
57+
case (.optional, .percent): decimalOptionalPercentView
5758
}
5859
}
5960

Examples/DiffableTextAppXUIKit/App/Screens.Number/NumberScreenOptionalToggle.swift

Lines changed: 0 additions & 40 deletions
This file was deleted.

Examples/DiffableTextAppXUIKit/App/Screens.Pattern/PatternScreen.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ struct PatternScreen: View {
3030
var body: some View {
3131
Screen {
3232
Scroller {
33-
Segments(context.kind.xwrapped)
33+
Segments(context.pattern.xwrapped)
3434

35-
PatternScreenVisibilityToggle(visible: context.visible)
35+
Segments(context.visibility.xwrapped)
3636

3737
PatternScreenActionsStack(context)
3838

0 commit comments

Comments
 (0)