Skip to content

Commit 538f10b

Browse files
CHORE: Update README & examples
1 parent 96e255d commit 538f10b

8 files changed

+60
-3
lines changed

README.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,51 @@
11
# cocoapods-xcconfig-hooks
22

3-
CocoaPods plugin to hook xcconfig of CocoaPods targets.
3+
[![Test](https://img.shields.io/github/workflow/status/trinhngocthuyen/cocoapods-xcconfig-hooks/test)](https://img.shields.io/github/workflow/status/trinhngocthuyen/cocoapods-xcconfig-hooks/test)
4+
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat&color=blue)](https://github.com/trinhngocthuyen/cocoapods-xcconfig-hooks/blob/main/LICENSE.txt)
5+
[![Gem](https://img.shields.io/gem/v/cocoapods-xcconfig-hooks.svg?style=flat&color=blue)](https://rubygems.org/gems/cocoapods-xcconfig-hooks)
6+
7+
A CocoaPods plugin to hook xcconfig of CocoaPods targets.
48

59
## Installation
610

711
$ gem install cocoapods-xcconfig-hooks
812

913
## Usage
1014

11-
TBU
15+
### Load the plugin
16+
17+
Load this plugin by adding the following line at the beginning of Podfile (example: [here](/examples/Podfile#L4)).
18+
19+
```rb
20+
plugin "cocoapods-xcconfig-hooks"
21+
```
22+
23+
### Configure the plugin (optional)
24+
25+
In Podfile, call the `config_xcconfig_hooks` method to provide customization for your setup (example: [here](/examples/Podfile#L6)).
26+
27+
```rb
28+
config_xcconfig_hooks(
29+
hook_dir: "path/to/xcconfig/dir",
30+
aggregate_targets_only: true
31+
)
32+
```
33+
34+
The following table explains the parameters of the `config_xcconfig_hooks` method.
35+
36+
| Parameter | Type | Default | Description |
37+
|------------------------|---------|------------|--------------------------------------------------------------------------------|
38+
| `hook_dir` | string | `.xcconfigs` | Path to the directory containing xcconfig files (relative to the project directory) |
39+
| `aggregate_targets_only` | boolean | `true` | Whether to hook aggregate targets only (ex. Pods-App, Pods-AppUITests...) |
40+
41+
After pod installation, the settings defined in those xcconfig files should be hooked to the project.
42+
43+
![](/resources/xcconfig.png)
44+
45+
### Order of xcconfig hooks
46+
47+
xcconfig files (if present in the `hook_dir`) are included in the following order.
48+
- `__base__.xcconfig`
49+
- `<configuration_name>.xcconfig` (ex. `debug.xcconfig`)
50+
- `<TargetName>.__base__.xcconfig` (ex: `Pods-Example.__base__.xcconfig`)
51+
- `<TargetName>.<configuration_name>.xcconfig` (ex: `Pods-Example.debug.xcconfig`)

examples/Podfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ use_frameworks!
33

44
plugin "cocoapods-xcconfig-hooks"
55

6+
config_xcconfig_hooks(
7+
hook_dir: "xcconfigs", # https://github.com/trinhngocthuyen/cocoapods-xcconfig-hooks/tree/main/examples/xcconfigs
8+
aggregate_target_only: true
9+
)
10+
611
target "Example" do
712
# Pods declaration goes here
813
end

examples/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
PODFILE CHECKSUM: aa11db2435ec6815332271a695bf71a281ddf018
1+
PODFILE CHECKSUM: d778bf15658ea86382d1bcea9ac9ac700e348015
22

33
COCOAPODS: 1.11.3
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Here, you can provide settings that should apply accross configurations, but to a particular target only
2+
3+
HOOKED_SETTING_EXAMPLE = default value
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Here, you can provide settings that should apply to a particular target and a particular configuration only
2+
3+
HOOKED_SETTING_EXAMPLE = something particular to app target (debug)

examples/xcconfigs/__base__.xcconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Here, you can provide settings that should apply accross targets and configurations
2+
3+
HOOKED_SETTING = default value

examples/xcconfigs/debug.xcconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Here, you can provide settings that should apply accross targets, but to a particular configuration only
2+
3+
HOOKED_SETTING = value for debug

resources/xcconfig.png

57.6 KB
Loading

0 commit comments

Comments
 (0)