Skip to content

Commit

Permalink
Merge pull request #17 from Dimillian/main
Browse files Browse the repository at this point in the history
Add VisionOS support
  • Loading branch information
divadretlaw authored Dec 7, 2023
2 parents 13f8ce5 + ef6fdb5 commit bb1fd02
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.6
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -9,7 +9,7 @@ let package = Package(
.iOS(.v15),
.macOS(.v12),
.tvOS(.v15),
.watchOS(.v8)
.visionOS(.v1),
],
products: [
.library(
Expand Down
30 changes: 30 additions & 0 deletions Package@swift-5.7.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "EmojiText",
platforms: [
.iOS(.v15),
.macOS(.v12),
.tvOS(.v15)
],
products: [
.library(
name: "EmojiText",
targets: ["EmojiText"]
)
],
dependencies: [
.package(url: "https://github.com/kean/Nuke", from: "12.0.0")
],
targets: [
.target(
name: "EmojiText",
dependencies: [
.product(name: "Nuke", package: "Nuke")
]
)
]
)
30 changes: 30 additions & 0 deletions Package@swift-5.8.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "EmojiText",
platforms: [
.iOS(.v15),
.macOS(.v12),
.tvOS(.v15)
],
products: [
.library(
name: "EmojiText",
targets: ["EmojiText"]
)
],
dependencies: [
.package(url: "https://github.com/kean/Nuke", from: "12.0.0")
],
targets: [
.target(
name: "EmojiText",
dependencies: [
.product(name: "Nuke", package: "Nuke")
]
)
]
)
2 changes: 1 addition & 1 deletion Sources/EmojiText/CADisplayLinkPublisher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI

#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
extension CADisplayLink {
@MainActor
struct CADisplayLinkPublisher {
Expand Down
2 changes: 1 addition & 1 deletion Sources/EmojiText/EmojiText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public struct EmojiText: View {

guard shouldAnimateIfNeeded, needsAnimation else { return }

#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
for await event in CADisplayLink.publish(mode: .common, stopOnLowPowerMode: emojiAnimatedMode.disabledOnLowPower).values {
renderTime = event.targetTimestamp
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/EmojiText/Extensions/Font+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import SwiftUI

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

extension UIFont {
Expand Down
4 changes: 2 additions & 2 deletions Sources/EmojiText/Extensions/Image+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import ImageIO

extension Image {
init(emojiImage: EmojiImage) {
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS) || os(visionOS)
self.init(uiImage: emojiImage)
#else
self.init(nsImage: emojiImage)
#endif
}
}

#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS) || os(visionOS)
import UIKit

extension UIImage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
import UIKit

extension UIContentSizeCategory {
Expand Down
2 changes: 1 addition & 1 deletion Sources/EmojiText/RenderedImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct RenderedImage: Hashable, Equatable {
init(image: EmojiImage, animated: Bool, targetHeight: CGFloat) {
self.systemName = nil
self.platformImage = image.scalePreservingAspectRatio(targetHeight: targetHeight)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS) || os(visionOS)
if animated {
self.animationImages = image.images?.map { $0.scalePreservingAspectRatio(targetHeight: targetHeight) }
} else {
Expand Down
2 changes: 1 addition & 1 deletion Sources/EmojiText/Typealiases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(watchOS) || os(visionOS)
import UIKit

/// Platform indepdendent image alias. Will be `UIImage`.
Expand Down
2 changes: 1 addition & 1 deletion Test/Tests/Snapshotting+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SnapshotTesting
import SwiftUI
import GraphicsRenderer

#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS)
#if os(iOS) || targetEnvironment(macCatalyst) || os(tvOS) || os(visionOS)
extension Snapshotting where Value: View, Format == UIImage {
static func rendered(size: CGSize, delay: UInt64 = 0) -> Snapshotting {
SimplySnapshotting
Expand Down

0 comments on commit bb1fd02

Please sign in to comment.