Skip to content

Commit

Permalink
Simpler code style on UIPasteboard+Helpers > UTType
Browse files Browse the repository at this point in the history
  • Loading branch information
AliSoftware committed Apr 19, 2024
1 parent c67821c commit bfa54e2
Showing 1 changed file with 21 additions and 33 deletions.
54 changes: 21 additions & 33 deletions Aztec/Classes/Extensions/UIPasteboard+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,58 +44,46 @@ extension UIPasteboard {
let identifier: String

static let html: UTType = {
UTType(identifier: {
if #available(iOS 14.0, *) {
UniformTypeIdentifiers.UTType.html.identifier
} else {
kUTTypeHTML as String
}
}())
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.html.identifier)
} else {
UTType(identifier:kUTTypeHTML as String)
}
}()
static let plainText: UTType = {
UTType(identifier: {
if #available(iOS 14.0, *) {
UniformTypeIdentifiers.UTType.utf8PlainText.identifier
} else {
kUTTypeUTF8PlainText as String
}
}())
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.utf8PlainText.identifier)
} else {
UTType(identifier: kUTTypeUTF8PlainText as String)
}
}()
static let richText: UTType = {
UTType(identifier: {
if #available(iOS 14.0, *) {
UniformTypeIdentifiers.UTType.text.identifier
UTType(identifier: UniformTypeIdentifiers.UTType.text.identifier)
} else {
kUTTypeText as String
UTType(identifier: kUTTypeText as String)
}
}())
}()
static let RTFText: UTType = {
UTType(identifier: {
if #available(iOS 14.0, *) {
UniformTypeIdentifiers.UTType.rtf.identifier
UTType(identifier: UniformTypeIdentifiers.UTType.rtf.identifier)
} else {
kUTTypeRTF as String
UTType(identifier: kUTTypeRTF as String)
}
}())
}()
static let RTFDText: UTType = {
UTType(identifier: {
if #available(iOS 14.0, *) {
UniformTypeIdentifiers.UTType.flatRTFD.identifier
UTType(identifier: UniformTypeIdentifiers.UTType.flatRTFD.identifier)
} else {
kUTTypeFlatRTFD as String
UTType(identifier: kUTTypeFlatRTFD as String)
}
}())
}()
static let URL: UTType = {
UTType(identifier: {
if #available(iOS 14.0, *) {
UniformTypeIdentifiers.UTType.url.identifier
} else {
kUTTypeURL as String
}
}())
if #available(iOS 14.0, *) {
UTType(identifier: UniformTypeIdentifiers.UTType.url.identifier)
} else {
UTType(identifier: kUTTypeURL as String)
}
}()
}

Expand Down

0 comments on commit bfa54e2

Please sign in to comment.