File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,23 +37,23 @@ based on donated code from [alunny / node-xcode](https://github.com/alunny/node-
3737## Example
3838
3939``` js
40- // API is a bit wonky right now
41- var xcode = require (' xcode' ),
42- fs = require (' fs' ),
43- projectPath = ' myproject.xcodeproj/project.pbxproj' ,
44- myProj = xcode .project (projectPath);
40+ const fs = require (' node:fs' );
41+ const xcode = require (' xcode' );
4542
46- // parsing is async, in a different process
43+ // Path to the Xcode project's project.pbxproj file.
44+ const projectPath = ' myproject.xcodeproj/project.pbxproj' ;
45+ // Create a PBXProject instance for the project.
46+ const myProj = xcode .project (projectPath);
47+
48+ // Parse the project file asynchronously before making changes.
4749myProj .parse (function (err ) {
4850 myProj .addHeaderFile (' foo.h' );
4951 myProj .addSourceFile (' foo.m' );
5052 myProj .addFramework (' FooKit.framework' );
5153
54+ // Write the updated project back to disk.
5255 fs .writeFileSync (projectPath, myProj .writeSync ());
53- console .log (' new project written' );
56+
57+ console .log (' New project written' );
5458});
5559```
56-
57- ## License
58-
59- Apache V2
You can’t perform that action at this time.
0 commit comments