From 27e876fe4d4e6e406d8c87201aef2b81d64448d0 Mon Sep 17 00:00:00 2001 From: mlch911 Date: Sun, 4 Jan 2026 20:06:23 +0800 Subject: [PATCH 1/2] Backport to Xcode 15 --- Package.swift | 7 +++++-- .../LiquidGlassKit/LiquidGlassEffectView.swift | 16 ++++++++++++++-- Sources/LiquidGlassKit/LiquidGlassSlider.swift | 6 +++++- Sources/LiquidGlassKit/LiquidGlassView.swift | 10 +++++----- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Package.swift b/Package.swift index 4097a99..f57e6ac 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 6.2 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -19,7 +19,10 @@ let package = Package( // Targets are the basic building blocks of a package, defining a module or a test suite. // Targets can depend on other targets in this package and products from dependencies. .target( - name: "LiquidGlassKit" + name: "LiquidGlassKit", + swiftSettings: [ + .enableExperimentalFeature("AccessLevelOnImport") + ] ), ] diff --git a/Sources/LiquidGlassKit/LiquidGlassEffectView.swift b/Sources/LiquidGlassKit/LiquidGlassEffectView.swift index 5bc3395..3855047 100644 --- a/Sources/LiquidGlassKit/LiquidGlassEffectView.swift +++ b/Sources/LiquidGlassKit/LiquidGlassEffectView.swift @@ -29,7 +29,7 @@ public class LiquidGlassEffectView: UIView, AnyVisualEffectView { let liquidGlassView = LiquidGlassView(effect.style.liquidGlass) addSubview(liquidGlassView) self.liquidGlassView = liquidGlassView - + setupContentView() } @@ -71,6 +71,7 @@ public class LiquidGlassEffect: UIVisualEffect { public enum Style { case regular, clear +#if compiler(>=6.2) @available(iOS 26.0, *) var nativeStyle: UIGlassEffect.Style { switch self { @@ -78,6 +79,7 @@ public class LiquidGlassEffect: UIVisualEffect { case .clear: .clear } } +#endif var liquidGlass: LiquidGlass { switch self { @@ -131,7 +133,7 @@ public class LiquidGlassContainerEffect: UIVisualEffect { self.isNative = isNative super.init() } - + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -146,6 +148,7 @@ extension UIVisualEffectView: AnyVisualEffectView { } public func VisualEffectView(effect: UIVisualEffect?) -> AnyVisualEffectView { if let effect = effect as? LiquidGlassEffect { +#if compiler(>=6.2) if #available(iOS 26.0, *), effect.isNative { let nativeEffect = UIGlassEffect(style: effect.style.nativeStyle) nativeEffect.isInteractive = effect.isInteractive @@ -156,7 +159,12 @@ public func VisualEffectView(effect: UIVisualEffect?) -> AnyVisualEffectView { // Returns custom iOS 18 implementation return LiquidGlassEffectView(effect: effect) } +#else + // Returns custom iOS 18 implementation + return LiquidGlassEffectView(effect: effect) +#endif } else if let effect = effect as? LiquidGlassContainerEffect { +#if compiler(>=6.2) if #available(iOS 26.0, *), effect.isNative { let nativeEffect = UIGlassContainerEffect() nativeEffect.spacing = effect.spacing @@ -166,6 +174,10 @@ public func VisualEffectView(effect: UIVisualEffect?) -> AnyVisualEffectView { // Returns custom iOS 18 implementation return LiquidGlassEffectView(effect: effect) } +#else + // Returns custom iOS 18 implementation + return LiquidGlassEffectView(effect: effect) +#endif } else { return UIVisualEffectView(effect: effect) } diff --git a/Sources/LiquidGlassKit/LiquidGlassSlider.swift b/Sources/LiquidGlassKit/LiquidGlassSlider.swift index a95b6f5..a46df73 100644 --- a/Sources/LiquidGlassKit/LiquidGlassSlider.swift +++ b/Sources/LiquidGlassKit/LiquidGlassSlider.swift @@ -66,13 +66,15 @@ open class LiquidGlassSlider: UIControl { /// A Boolean value indicating whether changes in the slider's value generate continuous update events. open var isContinuous: Bool = true +#if compiler(>=6.2) /// The slider's visual style. @available(iOS 26.0, *) open var sliderStyle: UISlider.Style { get { isThumbless ? .thumbless : .default } set { isThumbless = (newValue == .thumbless) } } - +#endif + /// Internal storage for slider style (true = thumbless, false = continuous). private var isThumbless: Bool = false @@ -850,8 +852,10 @@ public protocol AnySlider: UIControl { var minimumValueImage: UIImage? { get set } var maximumValueImage: UIImage? { get set } var isContinuous: Bool { get set } +#if compiler(>=6.2) @available(iOS 26.0, *) var sliderStyle: UISlider.Style { get set } +#endif var minimumTrackTintColor: UIColor? { get set } var maximumTrackTintColor: UIColor? { get set } var thumbTintColor: UIColor? { get set } diff --git a/Sources/LiquidGlassKit/LiquidGlassView.swift b/Sources/LiquidGlassKit/LiquidGlassView.swift index 41f1f4e..4173b72 100644 --- a/Sources/LiquidGlassKit/LiquidGlassView.swift +++ b/Sources/LiquidGlassKit/LiquidGlassView.swift @@ -68,12 +68,12 @@ struct LiquidGlass { glareOppositeSideBias: 0, glareIntensity: 0.01, glareEdgeSharpness: -0.2, - glareDirectionOffset: .pi * 0.9, + glareDirectionOffset: .pi * 0.9 ), backgroundTextureSizeCoefficient: 1 / magnification, backgroundTextureScaleCoefficient: magnification, backgroundTextureBlurRadius: 0, - shadowOverlay: true, + shadowOverlay: true ) } @@ -90,12 +90,12 @@ struct LiquidGlass { glareOppositeSideBias: 1, glareIntensity: 0.1, glareEdgeSharpness: -0.1, - glareDirectionOffset: -.pi / 4, + glareDirectionOffset: -.pi / 4 ), backgroundTextureSizeCoefficient: 1.1, backgroundTextureScaleCoefficient: 0.8, backgroundTextureBlurRadius: 0, - shadowOverlay: true, + shadowOverlay: true ) static let regular = Self.init( @@ -111,7 +111,7 @@ struct LiquidGlass { glareOppositeSideBias: 1, glareIntensity: 0.1, glareEdgeSharpness: -0.15, - glareDirectionOffset: -.pi / 4, + glareDirectionOffset: -.pi / 4 ), backgroundTextureSizeCoefficient: 1, backgroundTextureScaleCoefficient: 0.2, From a811edc4c38e4ed32b231d6bcb90ab1ea39d0e69 Mon Sep 17 00:00:00 2001 From: mlch911 Date: Mon, 5 Jan 2026 10:21:57 +0800 Subject: [PATCH 2/2] Add .gitignore --- .gitignore | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f02a488 --- /dev/null +++ b/.gitignore @@ -0,0 +1,138 @@ +# Created by https://www.toptal.com/developers/gitignore/api/swift,swiftpm,cocoapods,macos +# Edit at https://www.toptal.com/developers/gitignore?templates=swift,swiftpm,cocoapods,macos + +### CocoaPods ### +## CocoaPods GitIgnore Template + +# CocoaPods - Only use to conserve bandwidth / Save time on Pushing +# - Also handy if you have a large number of dependant pods +# - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE +Pods/ + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Swift ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +## Obj-C/Swift specific +*.hmap + +## App packaging +*.ipa +*.dSYM.zip +*.dSYM + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +.swiftpm + +.build/ + +# CocoaPods +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# Pods/ +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ + +# fastlane +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ + +### SwiftPM ### +Packages +xcuserdata +# *.xcodeproj + + +# End of https://www.toptal.com/developers/gitignore/api/swift,swiftpm,cocoapods,macos + + +buildServer.json