Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable native visionOS support #119

Merged
merged 5 commits into from
Jun 11, 2024
Merged
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
3 changes: 2 additions & 1 deletion AcknowList.podspec.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"ios": "13.0",
"tvos": "13.0",
"watchos": "7.0",
"osx": "10.15"
"osx": "10.15",
"visionos": "1.0"
},
"swift_version": "5.0"
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.2.0 (work in progress)

- Add visionOS support


## 3.1.0 (25 January 2024)

- Add `GitHubAPI` to get licenses from GitHub API
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Instantiate a `AcknowListSwiftUIView` with a path to the `plist` file, or with a
|:--|:--|:--|
| 📱 | iOS 9.0+ | iOS 13.0+ |
| 📺 | tvOS 9.0+ | tvOS 13.0+ |
| 🥽 | visionOS 1.0+ | visionOS 1.0+ |
| ⌚️ | *not supported* | watchOS 7.0+ |
| 💻 | *not supported* | macOS 10.15+ |

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Sources/AcknowList/AcknowListSwiftUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension Acknow: Identifiable {
}

/// View that displays a list of acknowledgements.
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, *)
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, visionOS 1.0.0, *)
public struct AcknowListSwiftUIView: View {

/// The represented array of `Acknow`.
Expand Down Expand Up @@ -111,7 +111,7 @@ public struct AcknowListSwiftUIView: View {
}

/// View that displays a row in a list of acknowledgements.
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, *)
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, visionOS 1.0.0, *)
public struct AcknowListRowSwiftUIView: View {

/// The represented `Acknow`.
Expand Down Expand Up @@ -159,7 +159,7 @@ public struct AcknowListRowSwiftUIView: View {
}
}

@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, *)
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, visionOS 1.0.0, *)
struct AcknowListSwiftUI_Previews: PreviewProvider {
static let license = """
Copyright (c) 2015-2024 Vincent Tourraine (https://www.vtourraine.net)
Expand Down
14 changes: 8 additions & 6 deletions Sources/AcknowList/AcknowListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

import Foundation

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit
#endif

#if os(iOS)
#if os(iOS) || os(visionOS)
import SafariServices
#endif

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
/// Subclass of `UITableViewController` that displays a list of acknowledgements.
@available(iOS 9.0.0, tvOS 9.0.0, *)
@available(iOS 9.0.0, tvOS 9.0.0, visionOS 1.0.0, *)
@available(iOSApplicationExtension, unavailable)
open class AcknowListViewController: UITableViewController {

Expand Down Expand Up @@ -449,12 +449,14 @@ open class AcknowListViewController: UITableViewController {
}

private func openRepository(_ repository: URL) {
#if !os(tvOS)
if canOpenRepository(repository) {
#if os(visionOS)
UIApplication.shared.open(repository)
#elseif !os(tvOS)
let safariViewController = SFSafariViewController(url: repository)
present(safariViewController, animated: true)
}
#endif
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/AcknowList/AcknowSwiftUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import SwiftUI

/// View that displays a single acknowledgement.
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, *)
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, visionOS 1.0.0, *)
public struct AcknowSwiftUIView: View {

/// The represented acknowledgement.
Expand Down Expand Up @@ -75,7 +75,7 @@ public struct AcknowSwiftUIView: View {
}
}

@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, *)
@available(iOS 13.0.0, macOS 10.15.0, watchOS 7.0.0, tvOS 13.0.0, visionOS 1.0.0, *)
struct AcknowSwiftUI_Previews: PreviewProvider {
static let license = """
Copyright (c) 2015-2024 Vincent Tourraine (https://www.vtourraine.net)
Expand Down
4 changes: 2 additions & 2 deletions Sources/AcknowList/AcknowViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#if os(iOS) || os(tvOS)
#if os(iOS) || os(tvOS) || os(visionOS)
import UIKit

/// Subclass of `UIViewController` that displays a single acknowledgement.
@available(iOS 9.0.0, tvOS 9.0.0, *)
@available(iOS 9.0.0, tvOS 9.0.0, visionOS 1.0.0, *)
open class AcknowViewController: UIViewController {

/// The main text view.
Expand Down
Loading