Skip to content

Commit 0398267

Browse files
committed
Simplify the type declaration
1 parent f10bfa7 commit 0398267

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

SDWebImageSwiftUI/Classes/AnimatedImage.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public struct AnimatedImage : PlatformViewRepresentable {
7272
var placeholder: PlatformImage?
7373

7474
// Coordinator
75-
var viewCreateBlock: ((PlatformView, PlatformViewRepresentableContext<AnimatedImage>) -> Void)?
76-
var viewUpdateBlock: ((PlatformView, PlatformViewRepresentableContext<AnimatedImage>) -> Void)?
75+
var viewCreateBlock: ((PlatformView, Context) -> Void)?
76+
var viewUpdateBlock: ((PlatformView, Context) -> Void)?
7777
static var viewDestroyBlock: ((PlatformView, Coordinator) -> Void)?
7878

7979
/// A Binding to control the animation. You can bind external logic to control the animation status.
@@ -217,15 +217,15 @@ public struct AnimatedImage : PlatformViewRepresentable {
217217
}
218218
}
219219

220-
func makeView(context: PlatformViewRepresentableContext<AnimatedImage>) -> AnimatedImageViewWrapper {
220+
func makeView(context: Context) -> AnimatedImageViewWrapper {
221221
let view = AnimatedImageViewWrapper()
222222
if let viewCreateBlock = viewCreateBlock {
223223
viewCreateBlock(view.wrapped, context)
224224
}
225225
return view
226226
}
227227

228-
func updateView(_ view: AnimatedImageViewWrapper, context: PlatformViewRepresentableContext<AnimatedImage>) {
228+
func updateView(_ view: AnimatedImageViewWrapper, context: Context) {
229229
// macOS SDAnimatedImageView.animates should initialize to true in advance before set image
230230
#if os(macOS)
231231
view.wrapped.animates = true
@@ -285,7 +285,7 @@ public struct AnimatedImage : PlatformViewRepresentable {
285285
}
286286
}
287287

288-
func layoutView(_ view: AnimatedImageViewWrapper, context: PlatformViewRepresentableContext<AnimatedImage>) {
288+
func layoutView(_ view: AnimatedImageViewWrapper, context: Context) {
289289
// AspectRatio && ContentMode
290290
#if os(macOS)
291291
let contentMode: NSImageScaling
@@ -442,7 +442,7 @@ public struct AnimatedImage : PlatformViewRepresentable {
442442
#endif
443443
}
444444

445-
func configureView(_ view: AnimatedImageViewWrapper, context: PlatformViewRepresentableContext<AnimatedImage>) {
445+
func configureView(_ view: AnimatedImageViewWrapper, context: Context) {
446446
#if os(macOS) || os(iOS) || os(tvOS)
447447
// IncrementalLoad
448448
if let incrementalLoad = self.incrementalLoad {
@@ -667,7 +667,7 @@ extension AnimatedImage {
667667
/// Provide the action when view representable create the native view.
668668
/// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the context.
669669
/// - Returns: A view that triggers `action` when view representable create the native view.
670-
public func onViewCreate(perform action: ((PlatformView, PlatformViewRepresentableContext<AnimatedImage>) -> Void)? = nil) -> AnimatedImage {
670+
public func onViewCreate(perform action: ((PlatformView, Context) -> Void)? = nil) -> AnimatedImage {
671671
var result = self
672672
result.viewCreateBlock = action
673673
return result
@@ -676,7 +676,7 @@ extension AnimatedImage {
676676
/// Provide the action when view representable update the native view.
677677
/// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the context.
678678
/// - Returns: A view that triggers `action` when view representable update the native view.
679-
public func onViewUpdate(perform action: ((PlatformView, PlatformViewRepresentableContext<AnimatedImage>) -> Void)? = nil) -> AnimatedImage {
679+
public func onViewUpdate(perform action: ((PlatformView, Context) -> Void)? = nil) -> AnimatedImage {
680680
var result = self
681681
result.viewUpdateBlock = action
682682
return result

0 commit comments

Comments
 (0)