Skip to content

Commit fe9a9d3

Browse files
authored
Merge pull request #37 from v2er-app/feature/centralize-version-config
refactor: centralize version configuration
2 parents 88dce8c + 438ea6d commit fe9a9d3

File tree

3 files changed

+86
-4
lines changed

3 files changed

+86
-4
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 = 28;
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.1;
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 = 28;
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.1;
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: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Version Management Guide
2+
3+
## Version Terminology
4+
5+
This project uses two version identifiers:
6+
7+
### VERSION_NAME (MARKETING_VERSION in Xcode)
8+
- **What**: User-facing version number (e.g., "1.1.2")
9+
- **Where**: Displayed in App Store and Settings
10+
- **Format**: MAJOR.MINOR.PATCH
11+
- **When to change**: For feature releases and updates
12+
13+
### VERSION_CODE (CURRENT_PROJECT_VERSION in Xcode)
14+
- **What**: Build number (e.g., "28", "29", "30")
15+
- **Where**: Used internally by Apple for tracking builds
16+
- **Format**: Integer that must always increase
17+
- **When to change**: Every single build uploaded to TestFlight/App Store
18+
19+
## ✅ Centralized Version Configuration
20+
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 */
34+
```
35+
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 */
41+
```
42+
43+
That's it! The target configurations will automatically inherit these values.
44+
45+
## Important Notes
46+
47+
1. **Both values must be updated** in both Debug and Release configurations
48+
2. **VERSION_CODE must always increase** - even for the same VERSION_NAME
49+
3. **Fastlane auto-increment**: Our Fastlane setup automatically increments VERSION_CODE for TestFlight builds
50+
4. **Info.plist**: Automatically uses these values via:
51+
- `$(MARKETING_VERSION)` → CFBundleShortVersionString (VERSION_NAME)
52+
- `$(CURRENT_PROJECT_VERSION)` → CFBundleVersion (VERSION_CODE)
53+
54+
## Example Version Progression
55+
56+
| VERSION_NAME | VERSION_CODE | Notes |
57+
|-------------|--------------|-------|
58+
| 1.1.0 | 27 | Previous release |
59+
| 1.1.1 | 28 | Bug fix release |
60+
| 1.1.2 | 29 | First build of 1.1.2 |
61+
| 1.1.2 | 30 | Second build of 1.1.2 (bug fix) |
62+
| 1.1.2 | 31 | Final 1.1.2 for App Store |
63+
| 1.2.0 | 32 | Next feature release |
64+
65+
## Why Two Separate Values?
66+
67+
- **VERSION_NAME**: What users see and understand
68+
- **VERSION_CODE**: Ensures every upload to Apple is unique
69+
- Multiple builds of the same version can exist (e.g., testing different fixes)
70+
- Apple requires VERSION_CODE to always increase for tracking

0 commit comments

Comments
 (0)