Skip to content

Commit

Permalink
Merge pull request #52 from fermoya/feat/support-tvos
Browse files Browse the repository at this point in the history
Adding support to tvOS 13.0+
  • Loading branch information
fermoya authored Jun 4, 2020
2 parents 721bcfc + e237fbd commit f8e13ef
Show file tree
Hide file tree
Showing 71 changed files with 1,488 additions and 62 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ let package = Package(
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.watchOS(.v6)
.watchOS(.v6),
.tvOS(.v13)
],
products: [
.library(
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Create vertical or horizontal pagers, align the cards, change the direction of t
* iOS 13.0+
* macOS 10.15+
* watchOS 6.0+
* tvOS 13.0+
* Swift 5.1+

*Note*: For legacy projects, install manually and use `#if available(iOS 13, *) // or other platform / version`.
Expand Down
2 changes: 2 additions & 0 deletions Sources/SwiftUIPager/Pager+Buildable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extension Pager: Buildable {
}

/// Disables dragging on `Pager`
#if !os(tvOS)
public func disableDragging() -> Self {
mutating(keyPath: \.allowsDragging, value: false)
}
Expand All @@ -74,6 +75,7 @@ extension Pager: Buildable {
public func swipeInteractionArea(_ value: SwipeInteractionArea) -> Self {
mutating(keyPath: \.swipeInteractionArea, value: value)
}
#endif

/// Changes the a the alignment of the pages relative to their container
///
Expand Down
13 changes: 10 additions & 3 deletions Sources/SwiftUIPager/Pager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,14 @@ public struct Pager<Element, ID, PageView>: View where PageView: View, Element:
}
.frame(size: size)

let wrappedView: AnyView = swipeInteractionArea == .page ? AnyView(stack) : AnyView(stack.contentShape(Rectangle()))

return wrappedView.gesture(allowsDragging ? swipeGesture : nil)
#if !os(tvOS)
var wrappedView: AnyView = swipeInteractionArea == .page ? AnyView(stack) : AnyView(stack.contentShape(Rectangle()))
wrappedView = AnyView(wrappedView.gesture(allowsDragging ? swipeGesture : nil))
#else
let wrappedView = stack
#endif

return wrappedView
.rotation3DEffect((isHorizontal ? .zero : Angle(degrees: 90)) + scrollDirectionAngle,
axis: (0, 0, 1))
.sizeTrackable($size)
Expand Down Expand Up @@ -196,6 +201,7 @@ extension Pager where ID == Element.ID, Element : Identifiable {
extension Pager {

/// `DragGesture` customized to work with `Pager`
#if !os(tvOS)
var swipeGesture: some Gesture {
DragGesture(minimumDistance: minimumDistance, coordinateSpace: .local)
.onChanged({ value in
Expand All @@ -222,5 +228,6 @@ extension Pager {
}
)
}
#endif

}
4 changes: 2 additions & 2 deletions SwiftUIPager.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "SwiftUIPager"
s.version = "1.6.0-beta.2"
s.version = "1.6.0-beta.3"
s.summary = "Native pager for SwiftUI. Easily to use, easy to customize."

s.description = <<-DESC
Expand All @@ -12,7 +12,7 @@ Pod::Spec.new do |s|
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "fermoya" => "[email protected]" }

s.platforms = { :ios => "13.0", :osx => "10.15", :watchos => "6.0" }
s.platforms = { :ios => "13.0", :osx => "10.15", :watchos => "6.0", :tvos => "13.0" }
s.swift_version = "5.1"

s.source = { :git => "https://github.com/fermoya/SwiftUIPager.git", :tag => "#{s.version}" }
Expand Down
54 changes: 40 additions & 14 deletions SwiftUIPager.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,56 +6,57 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-x86_64-simulator</string>
<string>tvos-x86_64-simulator</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<string>tvos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-x86_64-maccatalyst</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>x86_64</string>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>watchos-armv7k_arm64_32</string>
<string>watchos-i386-simulator</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>armv7k</string>
<string>arm64_32</string>
<string>i386</string>
</array>
<key>SupportedPlatform</key>
<string>watchos</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
Expand All @@ -71,18 +72,43 @@
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>watchos-i386-simulator</string>
<string>tvos-arm64</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>i386</string>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>watchos</string>
<string>tvos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-x86_64-simulator</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>watchos-armv7k_arm64_32</string>
<key>LibraryPath</key>
<string>SwiftUIPager.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>armv7k</string>
<string>arm64_32</string>
</array>
<key>SupportedPlatform</key>
<string>watchos</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,27 @@
</data>
<key>Modules/SwiftUIPager.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
<data>
sZ6T+H3OV1XqUc6JvBCQ89v5xSU=
b3o2pzrnH7JLnHpWxLkB7sgVbNM=
</data>
<key>Modules/SwiftUIPager.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
<data>
dV83wgMYlEOTT72CjfGG2RyZRXM=
wGWqpPXDjWruUPrYPGZBhV+u7qM=
</data>
<key>Modules/SwiftUIPager.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
<data>
JNpoSLHgLJ+OxgmqN52aqDAHw6M=
sN661PUVlKqAzOtOyeaaEffdIlY=
</data>
<key>Modules/SwiftUIPager.swiftmodule/x86_64.swiftdoc</key>
<data>
sZ6T+H3OV1XqUc6JvBCQ89v5xSU=
b3o2pzrnH7JLnHpWxLkB7sgVbNM=
</data>
<key>Modules/SwiftUIPager.swiftmodule/x86_64.swiftinterface</key>
<data>
dV83wgMYlEOTT72CjfGG2RyZRXM=
wGWqpPXDjWruUPrYPGZBhV+u7qM=
</data>
<key>Modules/SwiftUIPager.swiftmodule/x86_64.swiftmodule</key>
<data>
JNpoSLHgLJ+OxgmqN52aqDAHw6M=
sN661PUVlKqAzOtOyeaaEffdIlY=
</data>
<key>Modules/module.modulemap</key>
<data>
Expand All @@ -65,42 +65,42 @@
<dict>
<key>hash2</key>
<data>
FT/4y9l1xsEhYLncBwFwu3UQuDEZvlHa3WUo3XGiwWU=
u5OeZXOUs/jXSpCXiVO6N8SXQWtPzDum9BbX7AV6inA=
</data>
</dict>
<key>Modules/SwiftUIPager.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
<dict>
<key>hash2</key>
<data>
XQtv97BqFd6dJ28PmK72Fr4VGpYwO2xq+74/Q0WH1F0=
2QrLZtIgNXKC4cm+PWFYuohid/061Tr85lKDIkgnh4Q=
</data>
</dict>
<key>Modules/SwiftUIPager.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
<dict>
<key>hash2</key>
<data>
L5rDliNzv3tP2mCm06itZQ6HTJs868lO9WIslr6LXYs=
+3z0uLOFreMJ0K7lBQdOr65SThk7qcGjHKJkTfcdyA8=
</data>
</dict>
<key>Modules/SwiftUIPager.swiftmodule/x86_64.swiftdoc</key>
<dict>
<key>hash2</key>
<data>
FT/4y9l1xsEhYLncBwFwu3UQuDEZvlHa3WUo3XGiwWU=
u5OeZXOUs/jXSpCXiVO6N8SXQWtPzDum9BbX7AV6inA=
</data>
</dict>
<key>Modules/SwiftUIPager.swiftmodule/x86_64.swiftinterface</key>
<dict>
<key>hash2</key>
<data>
XQtv97BqFd6dJ28PmK72Fr4VGpYwO2xq+74/Q0WH1F0=
2QrLZtIgNXKC4cm+PWFYuohid/061Tr85lKDIkgnh4Q=
</data>
</dict>
<key>Modules/SwiftUIPager.swiftmodule/x86_64.swiftmodule</key>
<dict>
<key>hash2</key>
<data>
L5rDliNzv3tP2mCm06itZQ6HTJs868lO9WIslr6LXYs=
+3z0uLOFreMJ0K7lBQdOr65SThk7qcGjHKJkTfcdyA8=
</data>
</dict>
<key>Modules/module.modulemap</key>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public struct Pager<Element, ID, PageView> : SwiftUI.View where Element : Swift.
extension Pager where Element : Swift.Identifiable, ID == Element.ID {
public init(page: SwiftUI.Binding<Swift.Int>, data: [Element], @SwiftUI.ViewBuilder content: @escaping (Element) -> PageView)
}
extension Pager {
}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Equatable {}
extension SwiftUIPager.Pager.HorizontalSwipeDirection : Swift.Hashable {}
extension SwiftUIPager.Pager.VerticalSwipeDirection : Swift.Equatable {}
Expand Down
Binary file not shown.
Loading

0 comments on commit f8e13ef

Please sign in to comment.