Skip to content

Commit 821804c

Browse files
authored
Merge pull request #733 from Iterable/MOB-7672-bundle-module-issue
set nib according to sdk installation type
2 parents 44081a8 + 249061a commit 821804c

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,6 +2644,7 @@
26442644
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
26452645
MTL_ENABLE_DEBUG_INFO = YES;
26462646
ONLY_ACTIVE_ARCH = YES;
2647+
"OTHER_SWIFT_FLAGS[arch=*]" = "-DCOCOAPODS -DSPM";
26472648
PRODUCT_NAME = IterableSDK;
26482649
SDKROOT = iphoneos;
26492650
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
@@ -2704,6 +2705,7 @@
27042705
GCC_WARN_UNUSED_VARIABLE = YES;
27052706
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
27062707
MTL_ENABLE_DEBUG_INFO = NO;
2708+
"OTHER_SWIFT_FLAGS[arch=*]" = "-DSPM -DCOCOAPODS";
27072709
PRODUCT_NAME = IterableSDK;
27082710
SDKROOT = iphoneos;
27092711
SWIFT_COMPILATION_MODE = wholemodule;

swift-sdk/Internal/EmptyEmbeddedManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import Foundation
66

7-
class EmptyEmbeddedManager: IterableEmbeddedManagerProtocol {
7+
class EmptyEmbeddedManager: IterableInternalEmbeddedManagerProtocol {
88
func addUpdateListener(_ listener: IterableEmbeddedUpdateDelegate) {
99

1010
}

swift-sdk/uicomponents/IterableEmbeddedView.swift

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ public class IterableEmbeddedView:UIView {
181181
}
182182

183183
public init(message: IterableEmbeddedMessage, viewType: IterableEmbeddedViewType, config: IterableEmbeddedViewConfig?) {
184-
super.init(frame: CGRectZero)
184+
super.init(frame: CGRect.zero)
185185
xibSetup()
186186
configure(message: message, viewType: viewType, config: config)
187187
}
@@ -201,7 +201,18 @@ public class IterableEmbeddedView:UIView {
201201
}
202202

203203
func loadViewFromNib() -> UIView? {
204-
let nib = UINib(nibName: "IterableEmbeddedView", bundle: Bundle.module)
204+
var nib: UINib
205+
#if COCOAPODS
206+
let bundle = Bundle(path: Bundle(for: IterableEmbeddedView.self).path(forResource: "Resources", ofType: "bundle")!)
207+
nib = UINib(nibName: "IterableEmbeddedView", bundle: bundle)
208+
#else
209+
#if SWIFT_PACKAGE
210+
nib = UINib(nibName: "IterableEmbeddedView", bundle: Bundle.module)
211+
#else
212+
nib = UINib(nibName: "IterableEmbeddedView", bundle: Bundle.main)
213+
#endif
214+
#endif
215+
205216
let view = nib.instantiate(withOwner: self, options: nil).first as? UIView
206217
self.clipsToBounds = false
207218
return view

0 commit comments

Comments
 (0)