@@ -277,6 +277,84 @@ Workspace file references use location specifiers:
277277- ` container:path ` - Absolute container reference (rare)
278278- ` absolute:path ` - Absolute file path
279279
280+ ## XCConfig Support
281+
282+ Parse and manipulate Xcode configuration files (` .xcconfig ` ). These files define build settings that can be shared across targets and configurations.
283+
284+ ### Low-level API
285+
286+ ``` ts
287+ import * as xcconfig from " @bacons/xcode/xcconfig" ;
288+ import fs from " fs" ;
289+
290+ // Parse an xcconfig string
291+ const config = xcconfig .parse (`
292+ #include "Base.xcconfig"
293+ PRODUCT_NAME = MyApp
294+ OTHER_LDFLAGS[sdk=iphoneos*] = -framework UIKit
295+ ` );
296+
297+ // Parse from file (resolves #include directives)
298+ const config = xcconfig .parseFile (" /path/to/Project.xcconfig" );
299+
300+ // Flatten build settings (merges includes, applies conditions)
301+ const allSettings = xcconfig .flattenBuildSettings (config );
302+
303+ // Filter by platform conditions
304+ const iosSettings = xcconfig .flattenBuildSettings (config , {
305+ sdk: " iphoneos" ,
306+ arch: " arm64" ,
307+ config: " Release" ,
308+ });
309+
310+ // Serialize back to xcconfig format
311+ const output = xcconfig .build (config );
312+ fs .writeFileSync (" /path/to/Project.xcconfig" , output );
313+ ```
314+
315+ ### Conditional Settings
316+
317+ XCConfig supports conditional settings based on SDK, architecture, and configuration:
318+
319+ ```
320+ // SDK-specific settings
321+ OTHER_LDFLAGS[sdk=iphoneos*] = -framework UIKit
322+ OTHER_LDFLAGS[sdk=macosx*] = -framework AppKit
323+
324+ // Architecture-specific settings
325+ ARCHS[arch=arm64] = arm64
326+ ARCHS[arch=x86_64] = x86_64
327+
328+ // Configuration-specific settings
329+ GCC_OPTIMIZATION_LEVEL[config=Debug] = 0
330+ GCC_OPTIMIZATION_LEVEL[config=Release] = s
331+
332+ // Combined conditions
333+ LIBRARY_SEARCH_PATHS[sdk=iphoneos*][arch=arm64] = /usr/lib/arm64
334+ ```
335+
336+ ### Include Directives
337+
338+ ```
339+ // Required include - throws if file not found
340+ #include "Base.xcconfig"
341+
342+ // Optional include - silently ignored if file not found
343+ #include? "Optional.xcconfig"
344+ ```
345+
346+ ### Variable Expansion
347+
348+ XCConfig supports variable references and the ` $(inherited) ` keyword:
349+
350+ ```
351+ // Reference other settings
352+ PRODUCT_BUNDLE_IDENTIFIER = $(BUNDLE_ID_PREFIX).$(PRODUCT_NAME:lower)
353+
354+ // Inherit from included files
355+ OTHER_LDFLAGS = $(inherited) -framework UIKit
356+ ```
357+
280358## Solution
281359
282360- Uses a hand-optimized single-pass parser that is 11x faster than the legacy ` xcode ` package (which uses PEG.js).
@@ -307,7 +385,7 @@ We support the following types: `Object`, `Array`, `Data`, `String`. Notably, we
307385- [ ] Create robust xcode projects from scratch.
308386- [ ] Skills.
309387- [ ] Import from other tools.
310- - [ ] ** XCConfig** Parsing: ` .xcconfig ` file parsing with ` #include ` support and build settings flattening.
388+ - [x ] ** XCConfig** Parsing: ` .xcconfig ` file parsing with ` #include ` support and build settings flattening.
311389- [ ] ** XCSharedData** : Shared project data directory (schemes, breakpoints, workspace settings).
312390- [ ] ** XCSchemeManagement** : Scheme ordering, visibility, and management plist. Controls which schemes appear and in what order in Xcode.
313391- [ ] ** XCUserData** : User-specific data (breakpoints, UI state). Useful for tooling that manages user preferences.
0 commit comments