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
138 changes: 138 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
7 changes: 5 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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")
]
),

]
Expand Down
16 changes: 14 additions & 2 deletions Sources/LiquidGlassKit/LiquidGlassEffectView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class LiquidGlassEffectView: UIView, AnyVisualEffectView {
let liquidGlassView = LiquidGlassView(effect.style.liquidGlass)
addSubview(liquidGlassView)
self.liquidGlassView = liquidGlassView

setupContentView()
}

Expand Down Expand Up @@ -71,13 +71,15 @@ public class LiquidGlassEffect: UIVisualEffect {
public enum Style {
case regular, clear

#if compiler(>=6.2)
@available(iOS 26.0, *)
var nativeStyle: UIGlassEffect.Style {
switch self {
case .regular: .regular
case .clear: .clear
}
}
#endif

var liquidGlass: LiquidGlass {
switch self {
Expand Down Expand Up @@ -131,7 +133,7 @@ public class LiquidGlassContainerEffect: UIVisualEffect {
self.isNative = isNative
super.init()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
}
Expand Down
6 changes: 5 additions & 1 deletion Sources/LiquidGlassKit/LiquidGlassSlider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 }
Expand Down
10 changes: 5 additions & 5 deletions Sources/LiquidGlassKit/LiquidGlassView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand All @@ -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(
Expand All @@ -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,
Expand Down