convert string to base64 swift

import UIKit

extension String {

    func fromBase64() -> String? {
        guard let data = Data(base64Encoded: self) else {
            return nil
        }

        return String(data: data, encoding: .utf8)
    }

    func toBase64() -> String {
        return Data(self.utf8).base64EncodedString()
    }
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
base64 to data swift convert to base64 swift base64 decode string swift encode string to base64 swift how to decode base64 in swift swift 5 encode base 64 deocode base64 in swift decode base64e in swift decode base64encode in swift swift base64 decode base64 encoded string swift string base64 swift string to int64 in swift swift 5 base64 decode swift base64encode swift encode data to base64 swift string to base64 swift base64_encode swift base64encodedstring swift base64encoder swift base64 string decode base64 swift ios base64 encode strings swift base64 data to base64 string swift 4 convert string toBase64 swift 5 convert token to base64 swift 5 base-encode string seift swift from string to base64 base64 encode swift swift data to base64 base64Encoded data to string swift encode base64 swift btoa swift swift convert to base64 swift 5 base 64 encoding swift convert string to base64 swift btoa wift base64 string when to use base64 in swift username passwor "when to use base64 in swift" when to use base64 in swift do yo need to use base 64 encoding swift why base 64 encode in swift base 64 incoding swift for username password base 64 incoding swift base64 string swift Add text to base64 in Swift Convert String into base64 Swift string encoding base64 swift base 64 swift base64 to string swift 4 base64encodedstring swift 4 base64 data swift base64 data string swift base64 string to hash swift base64 data to string swift swift string decoding to base64 data to base64 encoded string swift data to base64 string swift convert base64 swift convert string to base64 swift
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source