O'Reilly logo

NativeScript for Angular Mobile Development by Nathanael J. Anderson, Nathan Walker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to convert Swift/ObjC methods to NativeScript

The last point of interest from RecordModel might be the save method, which will export our recording from the app's tmp directory to the app's documents folder while converting it to the smaller filesize .m4a audio format:

this._recorder.audioFile  .exportAsynchronouslyWithNameBaseDirExportFormatFromSampleToSampleCallback(    fileName, BaseDirectory.Documents, ExportFormat.M4a, null, null,     (af: AKAudioFile, err: NSError) => {      this.savedFilePath = documentsFilePath(fileName);  });

Long method name, right? Yes, indeed; some Swift/ObjC parameterized method names collapse to become very long. That particular method in Swift is defined as follows:

exportAsynchronously(name:baseDir:exportFormat:fromSample:toSample:callback:) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required