Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images are very pixelated in SwiftUI #93

Open
AdrianBinDC opened this issue Apr 6, 2021 · 0 comments
Open

Images are very pixelated in SwiftUI #93

AdrianBinDC opened this issue Apr 6, 2021 · 0 comments

Comments

@AdrianBinDC
Copy link

I brought FlagKit into a SwiftUI project via SPM and I notice the images are very pixelated.

This is the code I used to render the images:

struct ContentView: View {
    
    let country = "US"
    let width: CGFloat = 100
    let height: CGFloat = 100
    
    var body: some View {
        VStack {
            Image(uiImage: Flag(countryCode: country)!.image(style: .circle))
                .resizable()
                .aspectRatio(contentMode: .fit)
                .frame(width: width,
                       height: height,
                       alignment: .center)
            Image(uiImage: Flag(countryCode: country)!.image(style: .roundedRect))
                .resizable()
                .aspectRatio(contentMode: .fit)
                .frame(width: width,
                       height: height,
                       alignment: .center)
            Image(uiImage: Flag(countryCode: country)!.image(style: .square))
                .resizable()
                .aspectRatio(contentMode: .fit)
                .frame(width: width,
                       height: height,
                       alignment: .center)
            Image(uiImage: Flag(countryCode: country)!.originalImage)
                .resizable()
                .aspectRatio(contentMode: .fit)
                .frame(width: width,
                       height: height,
                       alignment: .center)
        }
    }
}

Simulator Screen Shot - iPhone 12 Pro Max - 2021-04-06 at 08 43 08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant