fix(android): resolve local asset image resource loading using asyncimage and bundle url
This commit is contained in:
@@ -15,8 +15,14 @@ struct LoginEmailView: View {
|
||||
|
||||
@ViewBuilder private var logoImage: some View {
|
||||
#if os(Android)
|
||||
SwiftUI.Image("pedifoods", bundle: .module)
|
||||
.resizable()
|
||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable()
|
||||
} else {
|
||||
Color.clear
|
||||
}
|
||||
}
|
||||
#else
|
||||
SwiftUI.Image("pedifoods")
|
||||
.resizable()
|
||||
|
||||
@@ -16,8 +16,14 @@ struct LoginView: View {
|
||||
|
||||
@ViewBuilder private var logoImage: some View {
|
||||
#if os(Android)
|
||||
SwiftUI.Image("pedifoods", bundle: .module)
|
||||
.resizable()
|
||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable()
|
||||
} else {
|
||||
Color.clear
|
||||
}
|
||||
}
|
||||
#else
|
||||
SwiftUI.Image("pedifoods")
|
||||
.resizable()
|
||||
@@ -26,8 +32,14 @@ struct LoginView: View {
|
||||
|
||||
@ViewBuilder private var pinHeroImage: some View {
|
||||
#if os(Android)
|
||||
SwiftUI.Image(colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app", bundle: .module)
|
||||
.resizable()
|
||||
AsyncImage(url: Bundle.module.url(forResource: colorScheme == .dark ? "pin_image_app_dark" : "pin_image_app", withExtension: "png")) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable()
|
||||
} else {
|
||||
Color.clear
|
||||
}
|
||||
}
|
||||
#else
|
||||
SwiftUI.Image("pin_image_app")
|
||||
.resizable()
|
||||
|
||||
@@ -26,11 +26,17 @@ struct OtpView: View {
|
||||
ScrollView {
|
||||
VStack(spacing: 0) {
|
||||
#if os(Android)
|
||||
SwiftUI.Image("pedifoods", bundle: .module)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: 74, height: 74)
|
||||
.padding(.top, 140)
|
||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable()
|
||||
} else {
|
||||
Color.clear
|
||||
}
|
||||
}
|
||||
.scaledToFit()
|
||||
.frame(width: 74, height: 74)
|
||||
.padding(.top, 140)
|
||||
#else
|
||||
SwiftUI.Image("pedifoods")
|
||||
.resizable()
|
||||
|
||||
@@ -19,8 +19,14 @@ struct RegistrationView: View {
|
||||
|
||||
@ViewBuilder private var logoImage: some View {
|
||||
#if os(Android)
|
||||
SwiftUI.Image("pedifoods", bundle: .module)
|
||||
.resizable()
|
||||
AsyncImage(url: Bundle.module.url(forResource: "pedifoods", withExtension: "png")) { phase in
|
||||
if let image = phase.image {
|
||||
image
|
||||
.resizable()
|
||||
} else {
|
||||
Color.clear
|
||||
}
|
||||
}
|
||||
#else
|
||||
SwiftUI.Image("pedifoods")
|
||||
.resizable()
|
||||
|
||||
Reference in New Issue
Block a user