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

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift