Skip to content

Commit

Permalink
[app] Ok, I have to admit SwiftUIX is super handy
Browse files Browse the repository at this point in the history
  • Loading branch information
kirb committed Mar 22, 2022
1 parent 7d354d9 commit be6fef8
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 23 deletions.
6 changes: 3 additions & 3 deletions App/UI/Settings/GroupedButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct GroupedButtonStyle: ButtonStyleSuperclass {
HStack {
configuration.label
Spacer()
Text(Image(systemName: "chevron.right"))
Text(Image(systemName: .chevronRight))
.foregroundColor(Color(UIColor.systemGray2))
.fontWeight(.semibold)
.imageScale(.small)
Expand All @@ -51,7 +51,7 @@ struct GroupedButtonStyle_Previews: PreviewProvider {
label: {
HStack {
IconView(
icon: Image(systemName: "sparkles")
icon: Image(systemName: .sparkles)
.resizable(),
backgroundColor: Color(UIColor.systemIndigo)
)
Expand All @@ -67,7 +67,7 @@ struct GroupedButtonStyle_Previews: PreviewProvider {
label: {
HStack {
IconView(
icon: Image(systemName: "sparkles")
icon: Image(systemName: .sparkles)
.resizable(),
backgroundColor: Color(UIColor.systemGreen)
)
Expand Down
10 changes: 5 additions & 5 deletions App/UI/Settings/IconView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct IconView_Previews: PreviewProvider {
label: {
HStack {
IconView(
icon: Image(systemName: "envelope")
icon: Image(systemName: .envelope)
.resizable(),
backgroundColor: .blue
)
Expand All @@ -57,7 +57,7 @@ struct IconView_Previews: PreviewProvider {
label: {
HStack {
IconView(
icon: Image(systemName: "heart")
icon: Image(systemName: .heart)
.resizable(),
backgroundColor: .red
)
Expand All @@ -70,7 +70,7 @@ struct IconView_Previews: PreviewProvider {
label: {
HStack {
IconView(
icon: Image(systemName: "doc")
icon: Image(systemName: .doc)
.resizable(),
backgroundColor: .gray
)
Expand All @@ -84,7 +84,7 @@ struct IconView_Previews: PreviewProvider {
HStack {
IconView(
size: .medium,
icon: Image(systemName: "star")
icon: Image(systemName: .star)
.resizable(),
backgroundColor: .yellow
)
Expand All @@ -103,7 +103,7 @@ struct IconView_Previews: PreviewProvider {
HStack {
IconView(
size: .large,
icon: Image(systemName: "sparkles")
icon: Image(systemName: .sparkles)
.resizable(),
backgroundColor: Color(UIColor.systemIndigo)
)
Expand Down
7 changes: 4 additions & 3 deletions App/UI/Settings/SettingsAboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import SwiftUIX

struct SettingsAboutView: View {

Expand Down Expand Up @@ -56,7 +57,7 @@ struct SettingsAboutView: View {
title: { Text("Email Support") },
icon: {
IconView(
icon: Image(systemName: "envelope")
icon: Image(systemName: .envelope)
.resizable(),
backgroundColor: .blue
)
Expand All @@ -82,7 +83,7 @@ struct SettingsAboutView: View {
title: { Text("Tip Jar") },
icon: {
IconView(
icon: Image(systemName: "heart")
icon: Image(systemName: .heart)
.resizable(),
backgroundColor: .red
)
Expand Down Expand Up @@ -113,7 +114,7 @@ struct SettingsAboutView: View {
title: { Text("Share NewTerm") },
icon: {
IconView(
icon: Image(systemName: "square.and.arrow.up")
icon: Image(systemName: .squareAndArrowUp)
.resizable(),
backgroundColor: Color(UIColor.systemIndigo)
)
Expand Down
2 changes: 1 addition & 1 deletion App/UI/Settings/SettingsAdvancedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct SettingsAdvancedView: View {
#if targetEnvironment(macCatalyst)
.pickerStyle(MenuPickerStyle())
#else
.pickerStyle(RadioGroupPickerStyle())
// .pickerStyle(RadioGroupPickerStyle())
#endif
}
}
Expand Down
21 changes: 12 additions & 9 deletions App/UI/Settings/SettingsPerformanceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import SwiftUIX

struct SettingsPerformanceView: View {

Expand All @@ -27,24 +28,26 @@ struct SettingsPerformanceView: View {

@ObservedObject var preferences = Preferences.shared

private var batteryImageName: String {
private var batteryImageName: SFSymbolName {
let device = UIDevice.current
device.isBatteryMonitoringEnabled = true
let percent = device.batteryLevel
let state = device.batteryState
device.isBatteryMonitoringEnabled = false
if state != .unknown {
if percent < 0.2 {
return "battery.0"
return .battery0
} else if percent < 0.4 {
return "battery.25"
} else if percent < 0.6 {
return "battery.50"
} else if percent < 0.8 {
return "battery.75"
return .battery25
} else if #available(iOS 15, *) {
if percent < 0.6 {
return .battery50
} else if percent < 0.8 {
return .battery75
}
}
}
return "battery.100"
return .battery100
}

var body: some View {
Expand All @@ -59,7 +62,7 @@ struct SettingsPerformanceView: View {
title: { Text(UIDevice.current.isPortable ? "On AC Power" : "Refresh Rate") },
icon: {
UIDevice.current.isPortable
? Image(systemName: "bolt.fill")
? Image(systemName: .boltFill)
.imageScale(.medium)
: nil
}
Expand Down
2 changes: 1 addition & 1 deletion App/UI/Settings/iOS/SettingsFontView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct SettingsFontView: View {
ForEach(sortedFonts, id: \.key) { key, value in
HStack(alignment: .center) {
if value.previewFont == nil {
Image(systemName: "arrow.down.circle")
Image(systemName: .arrowDownCircle)
.font(.body.weight(.medium))
.foregroundColor(.accentColor)
.accessibility(label: Text("Not installed. Tap to download."))
Expand Down
29 changes: 28 additions & 1 deletion NewTerm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
4E460121261EC8C0004DBCC2 /* UpdateCheckManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E460120261EC8C0004DBCC2 /* UpdateCheckManager.swift */; };
4E460129261FF23F004DBCC2 /* SettingsSceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E460128261FF23F004DBCC2 /* SettingsSceneDelegate.swift */; };
4E479710262D44D8003CF48C /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 4E479713262D44D8003CF48C /* Localizable.stringsdict */; };
4E4CB12027E9B33C001F07B6 /* SwiftUIX in Frameworks */ = {isa = PBXBuildFile; productRef = 4E4CB11F27E9B33C001F07B6 /* SwiftUIX */; };
4E57499826FEE90700D94DF5 /* PreferencesGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E57499726FEE90700D94DF5 /* PreferencesGroup.swift */; };
4E57499A26FEED9800D94DF5 /* PreferencesList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E57499926FEED9800D94DF5 /* PreferencesList.swift */; };
4E5E817526F2EBE000C4DB6D /* SettingsPerformanceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E5E817426F2EBE000C4DB6D /* SettingsPerformanceView.swift */; };
Expand Down Expand Up @@ -239,6 +240,7 @@
buildActionMask = 2147483647;
files = (
CF71BC9322BB6DEA00AFB1E1 /* NewTermCommon.framework in Frameworks */,
4E4CB12027E9B33C001F07B6 /* SwiftUIX in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -582,6 +584,9 @@
dependencies = (
);
name = "NewTerm (Theos)";
packageProductDependencies = (
4E4CB11E27E9B2DB001F07B6 /* SwiftUIX */,
);
passBuildSettingsInEnvironment = 0;
productName = NewTerm;
};
Expand Down Expand Up @@ -625,6 +630,9 @@
CF71BC9622BB6DEA00AFB1E1 /* PBXTargetDependency */,
);
name = "NewTerm (iOS)";
packageProductDependencies = (
4E4CB11F27E9B33C001F07B6 /* SwiftUIX */,
);
productName = "NewTerm (macOS)";
productReference = CFBB966122B546DA00585BE6 /* NewTerm.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -663,13 +671,14 @@
mainGroup = CF22F9A81FFB97F7003175DE;
packageReferences = (
4E9FB96A26171A01005AFCC8 /* XCRemoteSwiftPackageReference "SwiftTerm" */,
4E4CB11D27E9B2DB001F07B6 /* XCRemoteSwiftPackageReference "SwiftUIX" */,
);
productRefGroup = CF22F9A81FFB97F7003175DE;
projectDirPath = "";
projectRoot = "";
targets = (
CF22F9C01FFB98A5003175DE /* NewTerm (Theos) */,
CFBB966022B546DA00585BE6 /* NewTerm (iOS) */,
CF22F9C01FFB98A5003175DE /* NewTerm (Theos) */,
CF71BC8322BB6DBA00AFB1E1 /* NewTerm Common */,
);
};
Expand Down Expand Up @@ -1293,6 +1302,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
4E4CB11D27E9B2DB001F07B6 /* XCRemoteSwiftPackageReference "SwiftUIX" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SwiftUIX/SwiftUIX";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.1.2;
};
};
4E9FB96A26171A01005AFCC8 /* XCRemoteSwiftPackageReference "SwiftTerm" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/migueldeicaza/SwiftTerm.git";
Expand All @@ -1304,6 +1321,16 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
4E4CB11E27E9B2DB001F07B6 /* SwiftUIX */ = {
isa = XCSwiftPackageProductDependency;
package = 4E4CB11D27E9B2DB001F07B6 /* XCRemoteSwiftPackageReference "SwiftUIX" */;
productName = SwiftUIX;
};
4E4CB11F27E9B33C001F07B6 /* SwiftUIX */ = {
isa = XCSwiftPackageProductDependency;
package = 4E4CB11D27E9B2DB001F07B6 /* XCRemoteSwiftPackageReference "SwiftUIX" */;
productName = SwiftUIX;
};
4E9FB96B26171A01005AFCC8 /* SwiftTerm */ = {
isa = XCSwiftPackageProductDependency;
package = 4E9FB96A26171A01005AFCC8 /* XCRemoteSwiftPackageReference "SwiftTerm" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
"branch" : "main",
"revision" : "d661230c695e343fec580b531ac71e8db300594f"
}
},
{
"identity" : "swiftuix",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftUIX/SwiftUIX",
"state" : {
"revision" : "889c781539cdd1e6a1111472c711082522aa35c6",
"version" : "0.1.2"
}
}
],
"version" : 2
Expand Down

0 comments on commit be6fef8

Please sign in to comment.