Skip to content

Commit 9cf2f51

Browse files
authored
Merge pull request #321 from woxtu/available
Update platform names in `available` attributes
2 parents 9372a08 + 522e8bc commit 9cf2f51

10 files changed

+51
-51
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ class ViewController: UIViewController {
655655
}
656656

657657
// ContentView.swift
658-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
658+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
659659
struct ContentView : View {
660660
var body: some View {
661661
Group {

SDWebImageSwiftUI/Classes/AnimatedImage.swift

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import SDWebImage
1212
#if !os(watchOS)
1313

1414
/// A coordinator object used for `AnimatedImage`native view bridge for UIKit/AppKit.
15-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
15+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1616
public final class AnimatedImageCoordinator: NSObject {
1717

1818
/// Any user-provided object for actual coordinator, such as delegate method, taget-action
@@ -25,7 +25,7 @@ public final class AnimatedImageCoordinator: NSObject {
2525
}
2626

2727
/// Data Binding Object, only properties in this object can support changes from user with @State and refresh
28-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
28+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
2929
final class AnimatedImageModel : ObservableObject {
3030
enum Kind {
3131
case url
@@ -53,7 +53,7 @@ final class AnimatedImageModel : ObservableObject {
5353
}
5454

5555
/// Loading Binding Object, only properties in this object can support changes from user with @State and refresh
56-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
56+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
5757
final class AnimatedLoadingModel : ObservableObject {
5858
@Published var image: PlatformImage? // loaded image, note when progressive loading, this will published multiple times with different partial image
5959
@Published var isLoading: Bool = false // whether network is loading or cache is querying, should only be used for indicator binding
@@ -66,7 +66,7 @@ final class AnimatedLoadingModel : ObservableObject {
6666
}
6767

6868
/// Completion Handler Binding Object, supports dynamic @State changes
69-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
69+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
7070
final class AnimatedImageHandler: ObservableObject {
7171
// Completion Handler
7272
@Published var successBlock: ((PlatformImage, Data?, SDImageCacheType) -> Void)?
@@ -78,7 +78,7 @@ final class AnimatedImageHandler: ObservableObject {
7878
}
7979

8080
/// Layout Binding Object, supports dynamic @State changes
81-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
81+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
8282
final class AnimatedImageLayout : ObservableObject {
8383
var contentMode: ContentMode?
8484
var aspectRatio: CGFloat?
@@ -90,7 +90,7 @@ final class AnimatedImageLayout : ObservableObject {
9090
}
9191

9292
/// Configuration Binding Object, supports dynamic @State changes
93-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
93+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
9494
final class AnimatedImageConfiguration: ObservableObject {
9595
var incrementalLoad: Bool?
9696
var maxBufferSize: UInt?
@@ -106,7 +106,7 @@ final class AnimatedImageConfiguration: ObservableObject {
106106
}
107107

108108
/// A Image View type to load image from url, data or bundle. Supports animated and static image format.
109-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
109+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
110110
public struct AnimatedImage : PlatformViewRepresentable {
111111
@ObservedObject var imageModel: AnimatedImageModel
112112
@ObservedObject var imageHandler = AnimatedImageHandler()
@@ -591,7 +591,7 @@ public struct AnimatedImage : PlatformViewRepresentable {
591591
}
592592

593593
// Layout
594-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
594+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
595595
extension AnimatedImage {
596596

597597
/// Configurate this view's image with the specified cap insets and options.
@@ -631,7 +631,7 @@ extension AnimatedImage {
631631
}
632632

633633
// Aspect Ratio
634-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
634+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
635635
extension AnimatedImage {
636636
func setImageLayoutAspectRatio(_ aspectRatio: CGFloat?, contentMode: ContentMode) {
637637
self.imageLayout.aspectRatio = aspectRatio
@@ -693,7 +693,7 @@ extension AnimatedImage {
693693
}
694694

695695
// AnimatedImage Modifier
696-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
696+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
697697
extension AnimatedImage {
698698

699699
/// Total loop count for animated image rendering. Defaults to nil.
@@ -770,7 +770,7 @@ extension AnimatedImage {
770770
}
771771

772772
// Completion Handler
773-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
773+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
774774
extension AnimatedImage {
775775

776776
/// Provide the action when image load fails.
@@ -802,7 +802,7 @@ extension AnimatedImage {
802802
}
803803

804804
// View Coordinator Handler
805-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
805+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
806806
extension AnimatedImage {
807807

808808
/// Provide the action when view representable create the native view.
@@ -839,7 +839,7 @@ extension SDWebImageIndicator where Self == SDWebImageProgressIndicator {
839839
}
840840

841841
// Web Image convenience, based on UIKit/AppKit API
842-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
842+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
843843
extension AnimatedImage {
844844

845845
/// Associate a indicator when loading image with url
@@ -860,7 +860,7 @@ extension AnimatedImage {
860860
}
861861

862862
#if DEBUG
863-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
863+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
864864
struct AnimatedImage_Previews : PreviewProvider {
865865
static var previews: some View {
866866
Group {

SDWebImageSwiftUI/Classes/Image.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010
import SwiftUI
1111

12-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
12+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1313
extension Image {
1414
@inlinable init(platformImage: PlatformImage) {
1515
#if os(macOS)
@@ -20,13 +20,13 @@ extension Image {
2020
}
2121
}
2222

23-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
23+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
2424
extension PlatformImage {
2525
static var empty = PlatformImage()
2626
}
2727

2828
#if !os(macOS)
29-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
29+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
3030
extension PlatformImage.Orientation {
3131
@inlinable var toSwiftUI: Image.Orientation {
3232
switch self {
@@ -52,7 +52,7 @@ extension PlatformImage.Orientation {
5252
}
5353
}
5454

55-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
55+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
5656
extension Image.Orientation {
5757
@inlinable var toPlatform: PlatformImage.Orientation {
5858
switch self {

SDWebImageSwiftUI/Classes/ImageManager.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import SDWebImage
1212

1313
/// A Image observable object for handle image load process. This drive the Source of Truth for image loading status.
1414
/// You can use `@ObservedObject` to associate each instance of manager to your View type, which update your view's body from SwiftUI framework when image was loaded.
15-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
15+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1616
public final class ImageManager : ObservableObject {
1717
/// loaded image, note when progressive loading, this will published multiple times with different partial image
1818
public var image: PlatformImage? {
@@ -136,7 +136,7 @@ public final class ImageManager : ObservableObject {
136136
}
137137

138138
// Completion Handler
139-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
139+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
140140
extension ImageManager {
141141
/// Provide the action when image load fails.
142142
/// - Parameters:

SDWebImageSwiftUI/Classes/ImagePlayer.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Combine
1111
import SDWebImage
1212

1313
/// A Image observable object for handle aniamted image playback. This is used to avoid `@State` update may capture the View struct type and cause memory leak.
14-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
14+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1515
public final class ImagePlayer : ObservableObject {
1616
var player: SDAnimatedImagePlayer?
1717

SDWebImageSwiftUI/Classes/ImageViewWrapper.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import SDWebImage
1212
#if !os(watchOS)
1313

1414
/// Use wrapper to solve tne `UIImageView`/`NSImageView` frame size become image size issue (SwiftUI's Bug)
15-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
15+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1616
public class AnimatedImageViewWrapper : PlatformView {
1717
/// The wrapped actual image view, using SDWebImage's aniamted image view
1818
public var wrapped = SDAnimatedImageView()
@@ -67,7 +67,7 @@ public class AnimatedImageViewWrapper : PlatformView {
6767
}
6868
}
6969

70-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
70+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
7171
extension PlatformView {
7272
/// Adds constraints to this `UIView` instances `superview` object to make sure this always has the same size as the superview.
7373
/// Please note that this has no effect if its `superview` is `nil` – add this `UIView` instance as a subview before calling this.

SDWebImageSwiftUI/Classes/Indicator/Indicator.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SwiftUI
1010
import Combine
1111

1212
/// A type to build the indicator
13-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
13+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1414
public struct Indicator<T> where T : View {
1515
var content: (Binding<Bool>, Binding<Double>) -> T
1616

@@ -25,7 +25,7 @@ public struct Indicator<T> where T : View {
2525
}
2626

2727
/// A observable model to report indicator loading status
28-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
28+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
2929
public class IndicatorStatus : ObservableObject {
3030
/// whether indicator is loading or not
3131
var isLoading: Bool = false {
@@ -48,7 +48,7 @@ public class IndicatorStatus : ObservableObject {
4848
/// A implementation detail View Modifier with indicator
4949
/// SwiftUI View Modifier construced by using a internal View type which modify the `body`
5050
/// It use type system to represent the view hierarchy, and Swift `some View` syntax to hide the type detail for users
51-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
51+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
5252
public struct IndicatorViewModifier<T> : ViewModifier where T : View {
5353

5454
/// The loading status
@@ -72,7 +72,7 @@ public struct IndicatorViewModifier<T> : ViewModifier where T : View {
7272
}
7373
}
7474

75-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
75+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
7676
extension Indicator where T == AnyView {
7777
/// Activity Indicator
7878
public static var activity: Indicator<T> {
@@ -90,7 +90,7 @@ extension Indicator where T == AnyView {
9090
}
9191
}
9292

93-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
93+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
9494
extension Indicator where T == AnyView {
9595
/// Progress Indicator
9696
public static var progress: Indicator<T> {

SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift

+11-11
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,53 @@ import SwiftUI
1111
@_exported import SDWebImage // Automatically import SDWebImage
1212

1313
#if os(macOS)
14-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
14+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1515
public typealias PlatformImage = NSImage
1616
#else
17-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
17+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1818
public typealias PlatformImage = UIImage
1919
#endif
2020

2121
#if os(macOS)
22-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
22+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
2323
public typealias PlatformView = NSView
2424
#endif
2525
#if os(iOS) || os(tvOS) || os(visionOS)
26-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
26+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
2727
public typealias PlatformView = UIView
2828
#endif
2929
#if os(watchOS)
30-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
30+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
3131
public typealias PlatformView = WKInterfaceObject
3232
#endif
3333

3434
#if os(macOS)
35-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
35+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
3636
public typealias PlatformViewRepresentable = NSViewRepresentable
3737
#endif
3838
#if os(iOS) || os(tvOS) || os(visionOS)
39-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
39+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
4040
public typealias PlatformViewRepresentable = UIViewRepresentable
4141
#endif
4242
#if os(watchOS)
43-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
43+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
4444
public typealias PlatformViewRepresentable = WKInterfaceObjectRepresentable
4545
#endif
4646

4747
#if os(macOS)
48-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
48+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
4949
extension NSViewRepresentable {
5050
typealias PlatformViewType = NSViewType
5151
}
5252
#endif
5353
#if os(iOS) || os(tvOS) || os(visionOS)
54-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
54+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
5555
extension UIViewRepresentable {
5656
typealias PlatformViewType = UIViewType
5757
}
5858
#endif
5959
#if os(watchOS)
60-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
60+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
6161
extension WKInterfaceObjectRepresentable {
6262
typealias PlatformViewType = WKInterfaceObjectType
6363
}

SDWebImageSwiftUI/Classes/Transition/Transition.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import SwiftUI
1010

11-
@available(iOS 14.0, OSX 11.0, tvOS 14.0, watchOS 7.0, *)
11+
@available(iOS 14.0, macOS 11.0, tvOS 14.0, watchOS 7.0, *)
1212
extension AnyTransition {
1313

1414
/// Fade-in transition

0 commit comments

Comments
 (0)