Skip to content

Commit

Permalink
Support iOS 15
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes committed Jan 22, 2024
1 parent 30bb1d7 commit 30f63c4
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -491,6 +492,7 @@
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Binary file modified Impedance Converter/Impedance Converter/Segment7Standard.otf
Binary file not shown.
66 changes: 47 additions & 19 deletions Impedance Converter/Impedance Converter/UnitInputView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ struct UnitInputView<UnitType>: View where UnitType: RawRepresentable & Hashable
TextField("", text: $displayedValue)
.multilineTextAlignment(.trailing)
.font(.custom("Segment7Standard", size: 30))
.kerning(3)
.lineLimit(1)
.minimumScaleFactor(0.5)
.foregroundColor(Color.basePrimaryOrange.adjusted(brightness: disabled() ? 0.5 : 1.6))
Expand All @@ -174,7 +173,6 @@ struct UnitInputView<UnitType>: View where UnitType: RawRepresentable & Hashable
TextField("", text: $displayedValue)
.multilineTextAlignment(.trailing)
.font(.custom("Segment7Standard", size: 30))
.kerning(3)
.lineLimit(1)
.minimumScaleFactor(0.5)
.foregroundColor(Color.basePrimaryOrange.adjusted(brightness: disabled() ? 0.5 : 1.5))
Expand Down Expand Up @@ -208,27 +206,57 @@ struct UnitInputView<UnitType>: View where UnitType: RawRepresentable & Hashable
}
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
if isFocused {
if showNegationDecorator {
if #available(iOS 16, *) {
// iOS 16 and above layout (without HStack)
if isFocused {
if showNegationDecorator {
Spacer()
Button(action: toggleNegation) {
Text("-")
.font(.custom("Segment7Standard", size: 30))
.foregroundColor(.black)
}
.frame(minWidth: 44)
}
Spacer()
Button(action: toggleNegation) {
Text("-")
.font(.custom("Segment7Standard", size: 30))
.foregroundColor(.black)
ForEach(unitCases, id: \.self) { unitCase in
Button(action: {
selectUnit(unitCase)
}) {
Text(unitCase.shouldRender ? unitCase.rawValue : unitCases.count == 1 ? "" : "_")
.foregroundColor(Color.baseSecondaryRed.adjusted(brightness: 1.5))
.fontWeight(unitCase == unit ? .bold : .regular)
}
.frame(minWidth: 44)
Spacer()
}
.frame(minWidth: 44)
}
Spacer()
ForEach(unitCases, id: \.self) { unitCase in
Button(action: {
selectUnit(unitCase)
}) {
Text(unitCase.shouldRender ? unitCase.rawValue : unitCases.count == 1 ? "" : "_")
.foregroundColor(Color.baseSecondaryRed.adjusted(brightness: 1.5))
.fontWeight(unitCase == unit ? .bold : .regular)
} else {
// iOS 15 layout (with HStack) (but not centered)
HStack {
if isFocused {
if showNegationDecorator {
Spacer()
Button(action: toggleNegation) {
Text("-")
.font(.custom("Segment7Standard", size: 30))
.foregroundColor(.black)
}
.frame(minWidth: 44)
}
Spacer()
ForEach(unitCases, id: \.self) { unitCase in
Button(action: {
selectUnit(unitCase)
}) {
Text(unitCase.shouldRender ? unitCase.rawValue : unitCases.count == 1 ? "" : "_")
.foregroundColor(Color.baseSecondaryRed.adjusted(brightness: 1.5))
.fontWeight(unitCase == unit ? .bold : .regular)
}
.frame(minWidth: 44)
Spacer()
}
}
.frame(minWidth: 44)
Spacer()
}
}
}
Expand Down

0 comments on commit 30f63c4

Please # to comment.