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) } }