.isImage

๐Ÿ“— ๅƒ่€ƒ๏ผšSwift Playgrounds โŸฉ Image Gallery (Data Model: Gathering Image URLs)

import Foundation

extension URL {
    var isImage: Bool {
        ["jpg", "jpeg", "png", "gif", "heic"]
            .contains(self.pathExtension)
    }
}

Last updated