SyntaxFix
Write A Post
Hire A Developer
Questions
Objective-C
NSString *str = @"Hello World"; NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO];
Swift
let str = "Hello World" let data = string.data(using: String.Encoding.utf8, allowLossyConversion: false)