MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / fromBase64

Method fromBase64

packages/core/image-source/index.ios.ts:204–220  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

202 return uiImage ? new ImageSource(uiImage) : null;
203 }
204 static fromBase64(source: string): Promise<ImageSource> {
205 return new Promise<ImageSource>((resolve, reject) => {
206 try {
207 const data = NSData.alloc().initWithBase64EncodedStringOptions(source, NSDataBase64DecodingOptions.IgnoreUnknownCharacters);
208 const main_queue = dispatch_get_current_queue();
209 const background_queue = dispatch_get_global_queue(qos_class_t.QOS_CLASS_DEFAULT, 0);
210 dispatch_async(background_queue, () => {
211 const uiImage = UIImage.imageWithData(data);
212 dispatch_async(main_queue, () => {
213 resolve(new ImageSource(uiImage));
214 });
215 });
216 } catch (ex) {
217 reject(ex);
218 }
219 });
220 }
221
222 static fromFontIconCodeSync(source: string, font: Font, color: Color): ImageSource {
223 font = font || Font.default;

Callers 1

Calls 2

resolveFunction · 0.50
logMethod · 0.45

Tested by

no test coverage detected