Image(playground:)

ๅœจ Swift Playground for iPad ๅ…งไฝฟ็”จ๏ผš

#imageLiteral(resourceName: imgName)

็›ฎๅ‰ๅพ—ๅˆฐ็š„ๅœ–ๆช”ๅž‹ๅˆฅ้‚„ๆ˜ฏ UIImage๏ผŒๆ‰€ไปฅๅฟ…้ ˆๅˆฉ็”จไธ‹้ข็š„ๆ–นๅผๅ†่ฝ‰ไธ€ๆ‰‹ใ€‚

import SwiftUI

// usage: `Image(playground: "hokaido.png")`
extension Image {
    public init(playground imgName: String) {
        self.init(uiImage: #imageLiteral(resourceName: imgName))
    }
}

Last updated