Skip to content

Commit a054aa5

Browse files
feat(ios): Alternative debug config for SPM (#7982)
Co-authored-by: Mark Anderson <mark.anderson@outsystems.com>
1 parent a4a0942 commit a054aa5

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

ios-spm-template/App/App.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
504EC3111FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2828
504EC3131FED79650016851F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
2929
50B271D01FEDC1A000F3C39B /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = "<group>"; };
30+
958DCC722DB07C7200EA8C5F /* debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = debug.xcconfig; path = ../debug.xcconfig; sourceTree = SOURCE_ROOT; };
3031
/* End PBXFileReference section */
3132

3233
/* Begin PBXFrameworksBuildPhase section */
@@ -44,6 +45,7 @@
4445
504EC2FB1FED79650016851F = {
4546
isa = PBXGroup;
4647
children = (
48+
958DCC722DB07C7200EA8C5F /* debug.xcconfig */,
4749
504EC3061FED79650016851F /* App */,
4850
504EC3051FED79650016851F /* Products */,
4951
);
@@ -181,6 +183,7 @@
181183
/* Begin XCBuildConfiguration section */
182184
504EC3141FED79650016851F /* Debug */ = {
183185
isa = XCBuildConfiguration;
186+
baseConfigurationReference = 958DCC722DB07C7200EA8C5F /* debug.xcconfig */;
184187
buildSettings = {
185188
ALWAYS_SEARCH_USER_PATHS = NO;
186189
CLANG_ANALYZER_NONNULL = YES;
@@ -289,6 +292,7 @@
289292
};
290293
504EC3171FED79650016851F /* Debug */ = {
291294
isa = XCBuildConfiguration;
295+
baseConfigurationReference = 958DCC722DB07C7200EA8C5F /* debug.xcconfig */;
292296
buildSettings = {
293297
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
294298
CODE_SIGN_STYLE = Automatic;

ios-spm-template/App/App/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CAPACITOR_DEBUG</key>
6+
<string>$(CAPACITOR_DEBUG)</string>
57
<key>CFBundleDevelopmentRegion</key>
68
<string>en</string>
79
<key>CFBundleDisplayName</key>

ios-spm-template/debug.xcconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CAPACITOR_DEBUG = true

ios/Capacitor/Capacitor/CAPInstanceDescriptor.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ internal extension InstanceDescriptor {
139139
} else {
140140
#if DEBUG
141141
isWebDebuggable = true
142+
#else
143+
// this is needed for SPM xcframework Capacitor. Can eventually be removed when the SPM package moves to being source-based.
144+
if let debugValue = Bundle.main.object(forInfoDictionaryKey: "CAPACITOR_DEBUG") as? String, debugValue == "true" {
145+
isWebDebuggable = true
146+
}
142147
#endif
143148
}
144149
if let initialFocus = (config[keyPath: "ios.initialFocus"] as? Bool) ?? (config[keyPath: "initialFocus"] as? Bool) {

ios/Capacitor/Capacitor/CapacitorBridge.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {
2727
#if DEBUG
2828
return true
2929
#else
30+
// this is needed for SPM xcframework Capacitor. Can eventually be removed when the SPM package moves to being source-based.
31+
if let debugValue = Bundle.main.object(forInfoDictionaryKey: "CAPACITOR_DEBUG") as? String, debugValue == "true" {
32+
return true
33+
}
3034
return false
3135
#endif
3236
}

0 commit comments

Comments
 (0)