Skip to content

Commit

Permalink
Made the initializer of PhotoAttachmentCell public (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
masarusanjp authored Jul 12, 2024
1 parent 0ad97fe commit 9fe4de2
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public struct PhotoAttachmentCell: View {
@Injected(\.images) private var images
@Injected(\.fonts) private var fonts

@StateObject var assetLoader: PhotoAssetLoader
@ObservedObject var assetLoader: PhotoAssetLoader

@State private var assetURL: URL?
@State private var compressing = false
Expand All @@ -66,7 +66,21 @@ public struct PhotoAttachmentCell: View {
private var assetType: AssetType {
asset.mediaType == .video ? .video : .image
}


public init(
assetLoader: PhotoAssetLoader,
requestId: PHContentEditingInputRequestID? = nil,
asset: PHAsset,
onImageTap: @escaping (AddedAsset) -> Void,
imageSelected: @escaping (String) -> Bool
) {
_assetLoader = ObservedObject(initialValue: assetLoader)
self.requestId = requestId

Check failure on line 78 in Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAttachmentPickerView.swift

View workflow job for this annotation

GitHub Actions / Build Demo App (15.0.1, macos-14)

variable 'self.asset' used before being initialized

Check failure on line 78 in Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAttachmentPickerView.swift

View workflow job for this annotation

GitHub Actions / Build SDKs (Xcode 15.0)

variable 'self.asset' used before being initialized

Check failure on line 78 in Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAttachmentPickerView.swift

View workflow job for this annotation

GitHub Actions / Build Demo App (15.0.1, macos-14)

variable 'self.asset' used before being initialized

Check failure on line 78 in Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAttachmentPickerView.swift

View workflow job for this annotation

GitHub Actions / Build SDKs (Xcode 15.0)

variable 'self.asset' used before being initialized

Check failure on line 78 in Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAttachmentPickerView.swift

View workflow job for this annotation

GitHub Actions / Build Demo App (15.0.1, macos-14)

variable 'self.asset' used before being initialized

Check failure on line 78 in Sources/StreamChatSwiftUI/ChatChannel/Composer/PhotoAttachmentPickerView.swift

View workflow job for this annotation

GitHub Actions / Build SDKs (Xcode 15.0)

variable 'self.asset' used before being initialized
self.asset = asset
self.onImageTap = onImageTap
self.imageSelected = imageSelected
}

public var body: some View {
ZStack {
if let image = assetLoader.loadedImages[asset.localIdentifier] {
Expand Down

0 comments on commit 9fe4de2

Please sign in to comment.