Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

string to swift 2022

  let jsonText = "{"first_name":"Sergey"}"
        var dictonary:NSDictionary?
        
        if let data = jsonText.data(using: String.Encoding.utf8) {
            
            do {
                dictonary = try JSONSerialization.jsonObject(with: data, options: []) as? [String:AnyObject]
            
                if let myDictionary = dictonary
                {
                     print(" First name is: (myDictionary["first_name"]!)")
                }
            } catch let error as NSError {
                print(error)
            }
        }
Comment

PREVIOUS NEXT
Code Example
Swift :: How to find index of list item in Swift? 
Swift :: navigationbar large title swift 
Swift :: swift push view controller programmatically 
Swift :: string index in swift 
Swift :: swift date to string 
Swift :: swift guard let 
Swift :: change image tint color swiftui 
Swift :: swift dictionary contains key 
Swift :: how to add an underline to a textField swift 
Swift :: swift5 get uiview height 
Swift :: swift try catch 
Swift :: symfony swiftmailer 
Swift :: hello world in swift 
Swift :: swiftui textfield focus 
Swift :: Play Video in AVPlayer Sample Code Swift 
Swift :: swift create an empty dictionary 
Swift :: polymorphism in swift 
Swift :: button swift ui 
Swift :: get middle index of center cell in table view swift 
Swift :: Swift Add Two Numbers 
Swift :: how to debug before app launch swift 
Swift :: Swift Array With Mixed Data Types 
Swift :: swift array chunks 
Swift :: UISearchController keys 
Swift :: change textview link color swift 
Swift :: Trailing Closure Swift 
Swift :: Swift Labeled Statement with continue 
Swift :: property observer in swift 
Swift :: declare empty dictionary in swift 
Ruby :: rails undo scaffold 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =