another.im-ios/AnotherIM/xmpp/utils/String+Base64.swift
2024-12-16 08:19:58 +01:00

17 lines
427 B
Swift

import Foundation
extension String {
var base64Encoded: String {
// swiftlint:disable:next force_unwrapping
let utf8 = data(using: .utf8)!
let base64 = utf8.base64EncodedString()
return base64
}
var base64Decoded: String {
// swiftlint:disable:next force_unwrapping
let data = Data(base64Encoded: self)!
return String(decoding: data, as: UTF8.self)
}
}