Convert Dictionary to string in swift4 iOS

Solution:


  do {
                
        let theJSONData = try JSONSerialization.data(
                            withJSONObject: dic ,
                            options: JSONSerialization.WritingOptions(rawValue: 0))
                        let theJSONText = NSString(data: theJSONData,
                                                   encoding: String.Encoding.ascii.rawValue)
                       let str = String(describing: theJSONText)

                    } catch let error as NSError {
                        // handle error
                    }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift