Skip to content

Commit c7c0865

Browse files
Merge pull request #72 from paololeonardi/visionOS
Add Support for visionOS
2 parents d902037 + e3dd026 commit c7c0865

File tree

23 files changed

+381
-79
lines changed

23 files changed

+381
-79
lines changed

.github/workflows/run-tests-WaterfallGridSample.yml

+3
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,8 @@ jobs:
4848
- name: Build (tvOS)
4949
run: xcodebuild build -scheme WaterfallGrid -destination "platform=tvOS Simulator,OS=17.5,name=Apple TV" | xcpretty
5050

51+
- name: Build (visionOS)
52+
run: xcodebuild build -scheme WaterfallGrid -destination "platform=visionOS Simulator,OS=1.2,name=Apple Vision Pro" | xcpretty
53+
5154
- name: Build (watchOS)
5255
run: xcodebuild build -scheme WaterfallGrid -destination "platform=watchOS Simulator,OS=10.5,name=Apple Watch Ultra 2 (49mm)" | xcpretty

Package.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.9
22

33
//
44
// Copyright © 2019 Paolo Leonardi.
@@ -14,6 +14,7 @@ let package = Package(
1414
.iOS(.v13),
1515
.macOS(.v10_15),
1616
.tvOS(.v13),
17+
.visionOS(.v1),
1718
.watchOS(.v6)
1819
],
1920
products: [

README.md

+4-19
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,8 @@ A waterfall grid layout view for SwiftUI.
66
<img src="https://paololeonardi.github.io/waterfallgrid/resources/demo1.png" alt="Image Demo 1"/>
77
</p>
88

9-
<p align="center">
10-
<img src="https://img.shields.io/badge/Swift-5.1-red?style=flat" />
11-
<img src="https://img.shields.io/cocoapods/p/WaterfallGrid" />
12-
<a href="https://swift.org/package-manager">
13-
<img src="https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat" alt="Swift Package Manager" />
14-
</a>
15-
<img src="https://img.shields.io/cocoapods/v/WaterfallGrid?color=blue" />
16-
<a href="https://twitter.com/paololeonardi">
17-
<img src="https://img.shields.io/badge/[email protected]?style=flat" alt="Twitter: @paololeonardi" />
18-
</a>
19-
</p>
9+
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpaololeonardi%2FWaterfallGrid%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/paololeonardi/WaterfallGrid)
10+
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpaololeonardi%2FWaterfallGrid%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/paololeonardi/WaterfallGrid)
2011

2112
## Features
2213

@@ -26,12 +17,6 @@ A waterfall grid layout view for SwiftUI.
2617
- [x] Horizontal or vertical scroll direction.
2718
- [x] Items update can be animated.
2819

29-
## Requirements
30-
31-
- iOS 13.0+ / macOS 10.15+ / tvOS 13.0+ / watchOS 6.0+
32-
- Xcode 11.0+
33-
- Swift 5.1+
34-
3520
## Usage
3621

3722
### Initialization
@@ -174,7 +159,7 @@ Add it as a dependency within your `Package.swift` manifest:
174159

175160
```swift
176161
dependencies: [
177-
.package(url: "https://github.com/paololeonardi/WaterfallGrid.git", from: "1.0.0")
162+
.package(url: "https://github.com/paololeonardi/WaterfallGrid.git", from: "1.1.0")
178163
]
179164
```
180165

@@ -183,7 +168,7 @@ dependencies: [
183168
You can install `WaterfallGrid` via CocoaPods by adding the following line to your `Podfile`:
184169

185170
```ruby
186-
pod 'WaterfallGrid', '~> 1.0.0'
171+
pod 'WaterfallGrid', '~> 1.1.0'
187172
```
188173

189174
Run the `pod install` command to download the library

Sources/WaterfallGrid/Environment/GridSyle.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct GridSyle {
1414
let animation: Animation?
1515

1616
var columns: Int {
17-
#if os(OSX) || os(tvOS) || targetEnvironment(macCatalyst)
17+
#if os(OSX) || os(tvOS) || targetEnvironment(macCatalyst) || os(visionOS)
1818
return columnsInLandscape
1919
#elseif os(watchOS)
2020
return columnsInPortrait

Sources/WaterfallGrid/View+GridStyle.swift

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ extension View {
3737
/// - Parameter animation: The animation to apply when data change. If `animation` is `nil`, the grid doesn't animate.
3838
@available(OSX, unavailable)
3939
@available(tvOS, unavailable)
40+
@available(visionOS, unavailable)
4041
@available(watchOS, unavailable)
4142
public func gridStyle(
4243
columnsInPortrait: Int = 2,

Sources/WaterfallGrid/WaterfallGrid.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import SwiftUI
88

99
/// A container that presents items of variable heights arranged in a grid.
10-
@available(iOS 13, OSX 10.15, tvOS 13, watchOS 6, *)
10+
@available(iOS 13, OSX 10.15, tvOS 13, visionOS 1, watchOS 6, *)
1111
public struct WaterfallGrid<Data, ID, Content>: View where Data : RandomAccessCollection, Content : View, ID : Hashable {
1212

1313
@Environment(\.gridStyle) private var style
@@ -61,7 +61,7 @@ public struct WaterfallGrid<Data, ID, Content>: View where Data : RandomAccessCo
6161
.opacity(self.alignmentGuides[element[keyPath: self.dataId]] != nil ? 1 : 0)
6262
}
6363
}
64-
.animation(self.loaded ? self.style.animation : nil)
64+
.animation(self.loaded ? self.style.animation : nil, value: UUID())
6565
}
6666

6767
// MARK: - Helpers

WaterfallGrid.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "WaterfallGrid"
3-
spec.version = "1.0.1"
3+
spec.version = "1.1.0"
44
spec.summary = "A waterfall grid layout view for SwiftUI."
55
spec.homepage = "https://github.com/paololeonardi/WaterfallGrid"
66

@@ -14,7 +14,7 @@ Pod::Spec.new do |spec|
1414
spec.watchos.deployment_target = "6.0"
1515
spec.tvos.deployment_target = "13.0"
1616

17-
spec.swift_version = '5.1'
17+
spec.swift_version = '5.9'
1818

1919
spec.source = { :git => "https://github.com/paololeonardi/WaterfallGrid.git", :tag => "#{spec.version}" }
2020

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "[email protected]",
5+
"idiom" : "vision",
6+
"scale" : "2x"
7+
}
8+
],
9+
"info" : {
10+
"author" : "xcode",
11+
"version" : 1
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
},
6+
"layers" : [
7+
{
8+
"filename" : "Front.solidimagestacklayer"
9+
},
10+
{
11+
"filename" : "Middle.solidimagestacklayer"
12+
}
13+
]
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "vision",
5+
"scale" : "2x"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "[email protected]",
5+
"idiom" : "vision",
6+
"scale" : "2x"
7+
}
8+
],
9+
"info" : {
10+
"author" : "xcode",
11+
"version" : 1
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>UIApplicationSceneManifest</key>
6+
<dict>
7+
<key>UIApplicationPreferredDefaultSceneSessionRole</key>
8+
<string>UIWindowSceneSessionRoleApplication</string>
9+
<key>UIApplicationSupportsMultipleScenes</key>
10+
<true/>
11+
<key>UISceneConfigurations</key>
12+
<dict/>
13+
</dict>
14+
</dict>
15+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Copyright © 2024 Paolo Leonardi.
3+
//
4+
// Licensed under the MIT license. See the LICENSE file for more info.
5+
//
6+
7+
import SwiftUI
8+
9+
@main
10+
struct WaterfallGridSample_visionOSApp: App {
11+
var body: some Scene {
12+
WindowGroup {
13+
ContentView()
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)