Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ struct SegmentedControlExample: View {
}

var borderShape: some Shape {
if #available(iOS 26.0, *) {
return Capsule()
if usesLiquidGlassUI {
return AnyShape(Capsule())
} else {
return RoundedRectangle(cornerRadius: 9)
return AnyShape(RoundedRectangle(cornerRadius: 9))
}
}
}
Expand All @@ -51,6 +51,38 @@ struct SegmentedControlExample: View {
}
}
}

static var version: Int {
#if os(iOS)
#if canImport(os_availability_internal)
return Int(__IPHONE_OS_VERSION_MAX_ALLOWED)
#else
return Int.max
#endif
#else
return Int.max
#endif
}

static var requiresDesignCompatibility: Bool {
if let value = Bundle.main.infoDictionary?["UIDesignRequiresCompatibility"] as? Bool {
return value
}
return false
}

static var usesLiquidGlassUI: Bool {
if #available(iOS 26, *) {
#if os(iOS)
// This will tell if project is built below Xcode 26 or liquid glass is disabled by 'UIDesignRequiresCompatibility', if yes, then we should not update component style.
return !(version < 260000 || requiresDesignCompatibility)
#else
return true
#endif
} else {
return false
}
}
}

struct SegmentedControlExample_Previews: PreviewProvider {
Expand Down
37 changes: 37 additions & 0 deletions Sources/FioriSwiftUICore/Utils/LiquidGlassHelper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import Darwin
import Foundation
import SwiftUI

enum LiquidGlassHelper {
static var version: Int {
#if os(iOS)
#if canImport(os_availability_internal)
return Int(__IPHONE_OS_VERSION_MAX_ALLOWED)
#else
return Int.max
#endif
#else
return Int.max
#endif
}

static var requiresDesignCompatibility: Bool {
if let value = Bundle.main.infoDictionary?["UIDesignRequiresCompatibility"] as? Bool {
return value
}
return false
}

static var usesLiquidGlassUI: Bool {
if #available(iOS 26, *) {
#if os(iOS)
// This will tell if project is built below Xcode 26 or liquid glass is disabled by 'UIDesignRequiresCompatibility', yes, then we should not update component style.
return !(version < 260000 || requiresDesignCompatibility)
#else
return true
#endif
} else {
return false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ extension SegmentedControlPickerFioriStyle {
}

var borderShape: some Shape {
if #available(iOS 26.0, *) {
return Capsule()
if LiquidGlassHelper.usesLiquidGlassUI {
return AnyShape(Capsule())
} else {
return RoundedRectangle(cornerRadius: 9)
return AnyShape(RoundedRectangle(cornerRadius: 9))
}
}
}
Expand Down
Loading