'SwiftUI : How to set image in MacOs?
Solution 1:[1]
import SwiftUI
struct SigninView: View {
var body: some View {
VStack{
Image("Profile") // this is image name from xcassets
// Image(nsImage: NSImage(named: NSImage.folderName) ?? NSImage()) // method for system image
.resizable()
.scaledToFill()
.frame(width: 75, height: 75)
.clipped()
.aspectRatio(contentMode: .fill)
.padding()
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |