Skip to content

Commit

Permalink
Flatten the nested enum
Browse files Browse the repository at this point in the history
  • Loading branch information
zorikon committed Apr 10, 2024
1 parent 7ab9f58 commit e7bd167
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 15 deletions.
11 changes: 4 additions & 7 deletions Whisky/Utils/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@

import Foundation

enum Constant {
// swiftlint:disable:next type_name
enum width {
static let small: Double = 400
static let medium: Double = 500
static let large: Double = 600
}
enum ViewWidth {
static let small: Double = 400
static let medium: Double = 500
static let large: Double = 600
}
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/BottleCreationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct BottleCreationView: View {
}
}
.fixedVerticalSize()
.frame(width: Constant.width.small)
.frame(width: ViewWidth.small)
}

func submit() {
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/ConfigView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ struct DPIConfigSheetView: View {
}
}
.padding()
.frame(width: Constant.width.medium, height: 240)
.frame(width: ViewWidth.medium, height: 240)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/Pins/PinCreationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct PinCreationView: View {
}
}
.fixedVerticalSize()
.frame(minWidth: Constant.width.small)
.frame(minWidth: ViewWidth.small)
}

func submit() {
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Bottle/WinetricksView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ struct WinetricksView: View {
winetricks = await Winetricks.parseVerbs()
}
}
.frame(minWidth: Constant.width.large, minHeight: 400)
.frame(minWidth: ViewWidth.large, minHeight: 400)
}
}
2 changes: 1 addition & 1 deletion Whisky/Views/Common/RenameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct RenameView: View {
}
}
.fixedVerticalSize()
.frame(minWidth: Constant.width.small)
.frame(minWidth: ViewWidth.small)
}

var isNameValid: Bool {
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/FileOpenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct FileOpenView: View {
}
}
.fixedVerticalSize()
.frame(width: Constant.width.small)
.frame(width: ViewWidth.small)
.onAppear {
// Makes sure there are more than 0 bottles.
// Otherwise, it will crash on the nil cascade
Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ struct SettingsView: View {
}
.formStyle(.grouped)
.fixedVerticalSize()
.frame(width: Constant.width.medium)
.frame(width: ViewWidth.medium)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Whisky/Views/WhiskyApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct WhiskyApp: App {
var body: some Scene {
WindowGroup {
ContentView(showSetup: $showSetup)
.frame(minWidth: Constant.width.large, minHeight: 316)
.frame(minWidth: ViewWidth.large, minHeight: 316)
.environmentObject(BottleVM.shared)
.onAppear {
NSWindow.allowsAutomaticWindowTabbing = false
Expand Down

0 comments on commit e7bd167

Please sign in to comment.