Suresh Maidaragi
06/10/2024, 5:15 PMUIKitView {....}
Pablichjenkov
06/10/2024, 5:39 PMAndrei Salavei
06/10/2024, 6:06 PMSuresh Maidaragi
06/11/2024, 7:35 AMMaybe, using interop to UIImageView is not what you're looking for.yes I am not looking into this
Suresh Maidaragi
06/11/2024, 9:46 AMSuresh Maidaragi
06/11/2024, 9:47 AMUIKitView
in iosMainSuresh Maidaragi
06/11/2024, 9:51 AMAndrei Salavei
06/11/2024, 9:58 AMAndrei Salavei
06/11/2024, 9:59 AMthe swift image is not becoming visible, until we wrap returned UIView inside
Yes, that's the way to embed interop views. What code you're using to add image in the first case?in iosMainUIKitView
Suresh Maidaragi
06/11/2024, 10:01 AMSuresh Maidaragi
06/11/2024, 10:06 AMSuresh Maidaragi
06/11/2024, 10:21 AM//ImageLoaderiOS.swift
@MainActor
struct ImageView: View {
// Property to hold the input text
private var text: String = ""
public init?(string: String){
text = string
}
private let pipeline = ImagePipeline {
$0.dataLoader = {
let config = URLSessionConfiguration.default
config.urlCache = nil
return DataLoader(configuration: config)
}()
}
var body: some View {
VStack{
makeImage(url: URL(string: text))
}
}
func makeImage(url: URL?) -> some View {
LazyImage(url: url) { state in
if let image = state.image {
image
.resizable()
.aspectRatio(contentMode: .fill)
} else {
Color.gray.opacity(0.2)
}
}
.pipeline(pipeline)
.frame(height: 400)
.frame(width: 400)
}
}
Andrei Salavei
06/11/2024, 11:40 AMSuresh Maidaragi
06/11/2024, 11:54 AMIf you cannot resize your images on server, the most obvious solution here: download image from swift, resize it to required size, and then pass to Compose image view.instead passing swift UIView to compose image view, why can't we make ios view visible at called place itself i,e in swift itself and make it visible without adding it to UIKit
Suresh Maidaragi
06/11/2024, 11:56 AMAndrei Salavei
06/11/2024, 11:59 AMSuresh Maidaragi
06/11/2024, 12:02 PM