Skip to content

Commit 438ea6d

Browse files
committed
refactor: centralize version configuration to reduce duplication
- Moved MARKETING_VERSION and CURRENT_PROJECT_VERSION to project-level configs - Target configurations now inherit from project level (no more duplication) - Added Version.xcconfig file for documentation - Updated VERSIONING.md with clear instructions - Now only need to update 2 places instead of 4 when changing versions This makes version management less error-prone and easier to maintain.
1 parent c901c75 commit 438ea6d

File tree

3 files changed

+37
-13
lines changed

3 files changed

+37
-13
lines changed

V2er.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,12 +1061,14 @@
10611061
GCC_WARN_UNUSED_FUNCTION = YES;
10621062
GCC_WARN_UNUSED_VARIABLE = YES;
10631063
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1064+
MARKETING_VERSION = 1.1.2;
10641065
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
10651066
MTL_FAST_MATH = YES;
10661067
ONLY_ACTIVE_ARCH = YES;
10671068
SDKROOT = iphoneos;
10681069
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
10691070
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1071+
CURRENT_PROJECT_VERSION = 29;
10701072
};
10711073
name = Debug;
10721074
};
@@ -1116,12 +1118,14 @@
11161118
GCC_WARN_UNUSED_FUNCTION = YES;
11171119
GCC_WARN_UNUSED_VARIABLE = YES;
11181120
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
1121+
MARKETING_VERSION = 1.1.2;
11191122
MTL_ENABLE_DEBUG_INFO = NO;
11201123
MTL_FAST_MATH = YES;
11211124
SDKROOT = iphoneos;
11221125
SWIFT_COMPILATION_MODE = wholemodule;
11231126
SWIFT_OPTIMIZATION_LEVEL = "-O";
11241127
VALIDATE_PRODUCT = YES;
1128+
CURRENT_PROJECT_VERSION = 29;
11251129
};
11261130
name = Release;
11271131
};
@@ -1131,7 +1135,6 @@
11311135
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
11321136
CODE_SIGN_IDENTITY = "Apple Development";
11331137
CODE_SIGN_STYLE = Automatic;
1134-
CURRENT_PROJECT_VERSION = 29;
11351138
DEVELOPMENT_ASSET_PATHS = "\"V2er/Preview Content\"";
11361139
DEVELOPMENT_TEAM = DZCZQ4694Z;
11371140
ENABLE_PREVIEWS = YES;
@@ -1143,7 +1146,6 @@
11431146
"$(inherited)",
11441147
"@executable_path/Frameworks",
11451148
);
1146-
MARKETING_VERSION = 1.1.2;
11471149
PRODUCT_BUNDLE_IDENTIFIER = v2er.app;
11481150
PRODUCT_NAME = "$(TARGET_NAME)";
11491151
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1158,7 +1160,6 @@
11581160
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
11591161
CODE_SIGN_IDENTITY = "Apple Development";
11601162
CODE_SIGN_STYLE = Automatic;
1161-
CURRENT_PROJECT_VERSION = 29;
11621163
DEVELOPMENT_ASSET_PATHS = "\"V2er/Preview Content\"";
11631164
DEVELOPMENT_TEAM = DZCZQ4694Z;
11641165
ENABLE_PREVIEWS = YES;
@@ -1170,7 +1171,6 @@
11701171
"$(inherited)",
11711172
"@executable_path/Frameworks",
11721173
);
1173-
MARKETING_VERSION = 1.1.2;
11741174
PRODUCT_BUNDLE_IDENTIFIER = v2er.app;
11751175
PRODUCT_NAME = "$(TARGET_NAME)";
11761176
PROVISIONING_PROFILE_SPECIFIER = "";

V2er/Config/Version.xcconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Version.xcconfig
2+
// Centralized version configuration for V2er iOS app
3+
//
4+
// To update versions, only modify these two lines:
5+
// VERSION_NAME: User-facing version (e.g., 1.1.2)
6+
// VERSION_CODE: Build number (must always increase)
7+
8+
// VERSION_NAME - This is what users see (e.g., 1.1.2)
9+
MARKETING_VERSION = 1.1.2
10+
11+
// VERSION_CODE - Internal build number (e.g., 29, 30, 31...)
12+
CURRENT_PROJECT_VERSION = 29

VERSIONING.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,32 @@ This project uses two version identifiers:
1616
- **Format**: Integer that must always increase
1717
- **When to change**: Every single build uploaded to TestFlight/App Store
1818

19-
## How to Update Versions
19+
## ✅ Centralized Version Configuration
2020

21-
### Update VERSION_NAME (e.g., 1.1.1 → 1.1.2)
22-
```bash
23-
# In V2er.xcodeproj/project.pbxproj, update:
24-
MARKETING_VERSION = 1.1.2; # (This is VERSION_NAME)
21+
**Versions are now defined in ONE place only!**
22+
23+
The version numbers are defined at the project level and automatically inherited by all targets (Debug and Release).
24+
25+
### How to Update Versions
26+
27+
To update versions, you only need to modify **2 locations** in `V2er.xcodeproj/project.pbxproj`:
28+
29+
1. Search for the **Debug** project configuration and update:
30+
```
31+
/* Debug project configuration */
32+
MARKETING_VERSION = 1.1.2; /* VERSION_NAME */
33+
CURRENT_PROJECT_VERSION = 29; /* VERSION_CODE */
2534
```
2635

27-
### Update VERSION_CODE (e.g., 28 → 29)
28-
```bash
29-
# In V2er.xcodeproj/project.pbxproj, update:
30-
CURRENT_PROJECT_VERSION = 29; # (This is VERSION_CODE)
36+
2. Search for the **Release** project configuration and update:
37+
```
38+
/* Release project configuration */
39+
MARKETING_VERSION = 1.1.2; /* VERSION_NAME */
40+
CURRENT_PROJECT_VERSION = 29; /* VERSION_CODE */
3141
```
3242

43+
That's it! The target configurations will automatically inherit these values.
44+
3345
## Important Notes
3446

3547
1. **Both values must be updated** in both Debug and Release configurations

0 commit comments

Comments
 (0)