[Solved] Decode from Base64 format in swift


finally I found solution for my issue am getting exact out put.

    extension Character {
        var isAscii: Bool {
            return unicodeScalars.allSatisfy { $0.isASCII }
        }
    }
    extension RangeReplaceableCollection where Self: StringProtocol {
        var asciiPrintable: Self {
            return filter { $0.isAscii }
        }
    }
    class ViewController: UIViewController {
        override func viewDidLoad() {
            super.viewDidLoad()
            let base64Encoded = "oPvvNMsiOd//bheeboamB65AXi8r+go9NLz2rTPEJRU="
            let decodedData = Data(base64Encoded: base64Encoded, options: [])
            var decodedString: String? = nil
            if let decodedData = decodedData {
                decodedString = String(data: decodedData, encoding: .ascii)
                print(decodedString)
                let ascivalue = decodedString!.asciiPrintable
                print(ascivalue)
            }
        }
        }

Output: 

Optional(" ûï4Ë\"9ßÿn\u{17}n¦\u{07}®@^/+ú\n=4¼ö­3Ä%\u{15}")

4"9nn@^/+
=43%

solved Decode from Base64 format in swift