Objective-c to Swift conversion -
- (nsdata *)formencodedparameters:(nsdictionary *)parameters { nsarray *pairs = [parameters.allkeys mappedarraywithblock:^id(id obj) { return [nsstring stringwithformat:@"%@=%@", [obj stringbyaddingpercentescapesusingencoding:nsutf8stringencoding], [parameters[obj] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; }]; nsstring *formbody = [pairs componentsjoinedbystring:@"&"]; return [formbody datausingencoding:nsutf8stringencoding]; }
what best way convert method swift?
below link objective-c swift code "converter". matches syntax , replaces thinks appropriate.... still.... have kind of thing yourself. learn how code in swift , convert yourself.
in mean time (for educational reasons) can try converter: http://objectivec2swift.net/#/about
Comments
Post a Comment