commit 9999af1ab1577329116e8c6992ea3cb69ea1fad0
parent 57ea6031c7f7ed34b1bba83e87f7104d5d2f2ce4
Author: Marc Stibane <marc@taler.net>
Date: Sat, 8 Aug 2026 20:51:14 +0200
adapt for iOS26
Diffstat:
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/TalerWallet1/Views/HelperViews/SegmentControl.swift b/TalerWallet1/Views/HelperViews/SegmentControl.swift
@@ -16,16 +16,18 @@ struct SegmentControl: View {
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
@State private var selectedAccount = 0
- @ScaledMetric var frameHeight = 80 // relative to fontSize
+ @ScaledMetric var frameHeight = 60 // relative to fontSize
public var body: some View {
+ let is26: Bool = if #available(iOS 26.0, *) { true } else { false }
+ let cornerRadius: CGFloat = is26 ? 16.0 : 6.0
let count = accountDetails.count
if count > 0 {
ZStack(alignment: .center) {
GeometryReader { geo in
- RoundedRectangle(cornerRadius: 6.0)
+ RoundedRectangle(cornerRadius: cornerRadius)
.foregroundColor(WalletColors().pickerSelected(colorScheme, colorSchemeContrast))
- .cornerRadius(6.0)
+ .cornerRadius(cornerRadius)
.padding(4)
.frame(width: geo.size.width / CGFloat(count))
.offset(x: geo.size.width / CGFloat(count) * CGFloat(selectedAccount), y: 0)
@@ -77,7 +79,7 @@ struct SegmentControl: View {
action(selected)
}
.background(
- RoundedRectangle(cornerRadius: 6.0)
+ RoundedRectangle(cornerRadius: cornerRadius)
.fill(WalletColors().sideBackgroundColor)
)
}
@@ -93,13 +95,15 @@ struct SegmentControl2: View {
@Environment(\.colorSchemeContrast) private var colorSchemeContrast
public var body: some View {
+ let is26: Bool = if #available(iOS 26.0, *) { true } else { false }
+ let cornerRadius: CGFloat = is26 ? 16.0 : 6.0
let count = strings.count
if count > 0 {
ZStack(alignment: .center) {
GeometryReader { geo in
- RoundedRectangle(cornerRadius: 6.0)
+ RoundedRectangle(cornerRadius: cornerRadius)
.foregroundColor(WalletColors().pickerSelected(colorScheme, colorSchemeContrast))
- .cornerRadius(6.0)
+ .cornerRadius(cornerRadius)
.padding(4)
.frame(width: geo.size.width / CGFloat(count))
.offset(x: geo.size.width / CGFloat(count) * CGFloat(value), y: 0)
@@ -128,7 +132,7 @@ struct SegmentControl2: View {
}
}
.background(
- RoundedRectangle(cornerRadius: 6.0)
+ RoundedRectangle(cornerRadius: cornerRadius)
.fill(WalletColors().sideBackgroundColor)
)
}