Skip to content

Commit 9afb7db

Browse files
author
Evan Greer
committed
Merge branch 'embedded-messaging' into MOB-7053
# Conflicts: # swift-sdk/Internal/EmptyEmbeddedManager.swift # swift-sdk/Internal/IterableEmbeddedManager.swift
2 parents a314608 + 40006af commit 9afb7db

20 files changed

+1533
-155
lines changed

BannerViewDocuments/ClassName.jpg

22.9 KB
Loading
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# UI Components provided by IterableSDK
2+
3+
## IterableBannerView for iOS
4+
5+
This repository contains a collection of IBDesignable components for iOS, specifically the IterableBannerView. The IterableBannerView is a versatile component that allows you to create visually appealing banners with customizable features. With this component, you can easily display titles, descriptions, buttons, and image within a banner, providing a seamless user experience.
6+
7+
#### Usage
8+
- Open the storyboard or XIB file where you want to use the IterableBannerView.
9+
- In the Object Library, search for "View" or browse the list of available components.
10+
- Drag and drop the View onto your canvas.
11+
- Click on Identity Inspector.
12+
- Insert class name "IterableBannerView"
13+
14+
![ClassName](/BannerViewDocuments/ClassName.jpg)
15+
16+
### Design Samples
17+
![Sample 1](/BannerViewDocuments/Sample1.jpg)
18+
![Sample 2](/BannerViewDocuments/Sample2.jpg)
19+
![Sample 3](/BannerViewDocuments/Sample3.jpg)
20+
21+
### Customized
22+
Customize the various properties of the IterableBannerView in the Attributes Inspector, including:
23+
24+
![Property](/BannerViewDocuments/Property.jpg)
25+
26+
### View:
27+
- Set the corner radius
28+
- Shadow color
29+
- Shadow offset
30+
- Shadow radius
31+
- Background color of the view
32+
33+
### Title:
34+
- Specify the title text
35+
- Font size
36+
- Text color
37+
38+
### Description:
39+
- Set the description text.
40+
- Font size
41+
- Text color
42+
43+
### Primary Button:
44+
- Define the button text
45+
- Text color
46+
- Background color
47+
- Border radius
48+
49+
### Secondary Button:
50+
- Configure the button text
51+
- Text color
52+
- Background color
53+
- Border radius
54+
- Toggle its visibility.
55+
56+
### Image View:
57+
- Choose the background color
58+
- Border radius
59+
- Border color
60+
- Select an image
61+
- Set the size (width and height)
62+
63+
Preview and adjust the appearance of the IterableBannerView directly in Interface Builder.
64+
Build and run your project to see the IterableBannerView in action on your device or simulator.
65+
66+
## Video Preview
67+
<!-- ![Preview](/BannerViewDocuments/full_design_video.mp4) -->
68+
69+
### Full Sample Code
70+
71+
```swift
72+
import UIKit
73+
import Foundation
74+
import IterableSDK
75+
76+
struct IterableBannerData {
77+
let title: String
78+
let description: String
79+
let primaryButtonTitle: String
80+
let secondaryButtonTitle: String?
81+
let image: UIImage?
82+
}
83+
84+
class DesignSampleViewController: UIViewController, IterableBannerViewDelegate {
85+
86+
// Bind IBOutlet, using view from storyboard
87+
@IBOutlet weak var bannerViewBottom: IterableBannerView!
88+
89+
var iterableBannerData: [IterableBannerData] = []
90+
91+
// Create Programatically
92+
var bannerView = IterableBannerView(frame: CGRectMake(0, 50, 300, 159))
93+
var bannerViewSecond = IterableBannerView()
94+
95+
//MARK:
96+
override func viewDidLoad() {
97+
super.viewDidLoad()
98+
self.loadBannerData()
99+
}
100+
101+
override func viewDidAppear(_ animated: Bool) {
102+
super.viewDidAppear(animated)
103+
loadBannerView()
104+
loadSecondBanner()
105+
}
106+
107+
//MARK:
108+
func loadBannerData() {
109+
let firstBanner = IterableBannerData(title: "Try Gold Plan", description: "Enjoy 14 days of Premium", primaryButtonTitle: "Pay now", secondaryButtonTitle: nil, image: UIImage.init(named: "flag"))
110+
let secondBanner = IterableBannerData(title: "Try Silver Plan", description: "Enjoy 7 days of Premium \n Second line description", primaryButtonTitle: "Pay for 7 days", secondaryButtonTitle: nil, image: UIImage.init(named: "selectedsubscription.png"))
111+
iterableBannerData = [firstBanner,secondBanner]
112+
}
113+
114+
func loadBannerView() {
115+
bannerView.tag = 1
116+
bannerView.iterableBannerViewDelegate = self
117+
bannerView.frame = CGRectMake(16, 50, self.view.frame.width - 32, 159)
118+
bannerView.labelTitle.text = iterableBannerData[0].title
119+
bannerView.labelDescription.text = iterableBannerData[0].description
120+
bannerView.btnPrimary.setTitle(iterableBannerData[0].primaryButtonTitle, for: .normal)
121+
122+
if ((iterableBannerData[0].secondaryButtonTitle) != nil) {
123+
bannerView.btnSecondary.setTitle(iterableBannerData[0].secondaryButtonTitle, for: .normal)
124+
bannerView.isShowSecondaryButton = true
125+
}
126+
else {
127+
bannerView.isShowSecondaryButton = false
128+
}
129+
130+
bannerView.imgView.image = iterableBannerData[0].image
131+
bannerViewSecond.imgViewBorderWidth = 10
132+
bannerViewSecond.imgViewBorderColor = UIColor.systemOrange
133+
// Add a button action, an alternate option for a button event without using the delegate method.
134+
// bannerView.btnPrimary.addTarget(self, action: #selector (btnPrimaryPressed), for: .touchUpInside)
135+
self.view.addSubview(bannerView);
136+
}
137+
138+
func loadSecondBanner() {
139+
bannerViewSecond.tag = 2
140+
bannerViewSecond.iterableBannerViewDelegate = self
141+
bannerViewSecond.contentView.backgroundColor = UIColor.systemYellow
142+
bannerViewSecond.iterableBannerViewDelegate = self
143+
144+
bannerViewSecond.labelTitle.text = iterableBannerData[1].title
145+
bannerViewSecond.labelDescription.text = iterableBannerData[1].description + "new \n new"
146+
bannerViewSecond.btnPrimary.setTitle(iterableBannerData[1].primaryButtonTitle, for: .normal)
147+
148+
if ((iterableBannerData[1].secondaryButtonTitle) != nil) {
149+
bannerViewSecond.btnSecondary.setTitle(iterableBannerData[1].secondaryButtonTitle, for: .normal)
150+
bannerViewSecond.isShowSecondaryButton = true
151+
}
152+
else {
153+
bannerViewSecond.isShowSecondaryButton = false
154+
}
155+
bannerViewSecond.center = self.view.center
156+
bannerViewSecond.frame = CGRectMake(16, 159 + 50 + 25, self.view.frame.width - 32, 200)
157+
bannerViewSecond.imgView.image = iterableBannerData[1].image
158+
bannerViewSecond.imgView.backgroundColor = UIColor.clear
159+
bannerViewSecond.imgViewBorderWidth = 0
160+
bannerViewSecond.imgViewBorderColor = UIColor.clear
161+
self.view.addSubview(bannerViewSecond);
162+
}
163+
164+
//MARK: Button Pressed add target method
165+
@objc func btnPrimaryPressed () {
166+
print("btnPrimaryPressed")
167+
}
168+
169+
//MARK:IterableBannerViewDelegate Methods
170+
func didPressPrimaryButton(button: UIButton, viewTag: Int) {
171+
print("didPressPrimaryButton", viewTag)
172+
}
173+
174+
func didPressSecondaryButton(button: UIButton, viewTag: Int) {
175+
print("didPressSecondaryButton", viewTag)
176+
}
177+
178+
override func viewWillDisappear(_ animated: Bool) {
179+
super.viewWillDisappear(animated)
180+
}
181+
}
182+
```
183+
Happy designing with IterableBannerView!

BannerViewDocuments/Property.jpg

83.3 KB
Loading

BannerViewDocuments/Sample1.jpg

18.4 KB
Loading

BannerViewDocuments/Sample2.jpg

17.5 KB
Loading

BannerViewDocuments/Sample3.jpg

15.6 KB
Loading
3.15 MB
Binary file not shown.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ To learn more about various SDK features, read:
3737
- [Customizing Mobile Inbox on iOS](https://support.iterable.com/hc/articles/360039091471)
3838
- [iOS Universal Links](https://support.iterable.com/hc/articles/360035496511)
3939
- [Deep Links in Push Notifications](https://support.iterable.com/hc/articles/360035453971)
40+
- [UI Components](/BannerViewDocuments/IterableBannerViewReadme.md)
4041

4142
## Sample projects
4243

script.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cp -r "${SRCROOT}/swift-sdk/Resources" "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.app"

swift-sdk.xcodeproj/project.pbxproj

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@
175175
55E02D39253F8D86009DB8BC /* WebViewProtocolTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E02D38253F8D86009DB8BC /* WebViewProtocolTests.swift */; };
176176
55E6F462238E066400808BCE /* DeepLinkTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E6F45E238E066400808BCE /* DeepLinkTests.swift */; };
177177
55E9BE3429F9F5E6000C9FF2 /* DependencyContainerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 55E9BE3329F9F5E6000C9FF2 /* DependencyContainerProtocol.swift */; };
178+
560ACF482A308C8A007F9503 /* IterableBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560ACF462A308C8A007F9503 /* IterableBannerView.swift */; };
179+
564BCC302A30B60500A699B9 /* IterableBannerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 560ACF452A308C8A007F9503 /* IterableBannerView.xib */; };
178180
5B49BB3E27CFB71500E6F00C /* PopupInboxSessionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B49BB3D27CFB71500E6F00C /* PopupInboxSessionUITests.swift */; };
179181
5B5AA711284F1A6D0093FED4 /* MockNetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B5AA710284F1A6D0093FED4 /* MockNetworkSession.swift */; };
180182
5B5AA712284F1A6D0093FED4 /* MockNetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B5AA710284F1A6D0093FED4 /* MockNetworkSession.swift */; };
@@ -185,6 +187,7 @@
185187
5B5AA717284F1A6D0093FED4 /* MockNetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B5AA710284F1A6D0093FED4 /* MockNetworkSession.swift */; };
186188
5B6C3C1127CE871F00B9A753 /* NavInboxSessionUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B6C3C1027CE871F00B9A753 /* NavInboxSessionUITests.swift */; };
187189
5B88BC482805D09D004016E5 /* NetworkSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B88BC472805D09D004016E5 /* NetworkSession.swift */; };
190+
9F76FFFF2B17884900962526 /* EmbeddedHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F76FFFE2B17884900962526 /* EmbeddedHelper.swift */; };
188191
9FF05EAC2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
189192
9FF05EAD2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
190193
9FF05EAE2AFEA5FA005311F7 /* MockAuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */; };
@@ -596,11 +599,14 @@
596599
55E02D38253F8D86009DB8BC /* WebViewProtocolTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewProtocolTests.swift; sourceTree = "<group>"; };
597600
55E6F45E238E066400808BCE /* DeepLinkTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DeepLinkTests.swift; sourceTree = "<group>"; };
598601
55E9BE3329F9F5E6000C9FF2 /* DependencyContainerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DependencyContainerProtocol.swift; sourceTree = "<group>"; };
602+
560ACF452A308C8A007F9503 /* IterableBannerView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = IterableBannerView.xib; sourceTree = "<group>"; };
603+
560ACF462A308C8A007F9503 /* IterableBannerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IterableBannerView.swift; sourceTree = "<group>"; };
599604
5B49BB3D27CFB71500E6F00C /* PopupInboxSessionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PopupInboxSessionUITests.swift; sourceTree = "<group>"; };
600605
5B5AA710284F1A6D0093FED4 /* MockNetworkSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockNetworkSession.swift; sourceTree = "<group>"; };
601606
5B6C3C1027CE871F00B9A753 /* NavInboxSessionUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavInboxSessionUITests.swift; sourceTree = "<group>"; };
602607
5B88BC472805D09D004016E5 /* NetworkSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkSession.swift; sourceTree = "<group>"; };
603608
5BFC7CED27FC9AF300E77479 /* inbox-ui-tests-app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "inbox-ui-tests-app.entitlements"; sourceTree = "<group>"; };
609+
9F76FFFE2B17884900962526 /* EmbeddedHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmbeddedHelper.swift; sourceTree = "<group>"; };
604610
9FF05EAB2AFEA5FA005311F7 /* MockAuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAuthManager.swift; sourceTree = "<group>"; };
605611
AC02480722791E2100495FB9 /* IterableInboxNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IterableInboxNavigationViewController.swift; sourceTree = "<group>"; };
606612
AC02CAA5234E50B5006617E0 /* RegistrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationTests.swift; sourceTree = "<group>"; };
@@ -913,6 +919,7 @@
913919
551FA75C2988AC800072D0A9 /* Embedded Messaging */ = {
914920
isa = PBXGroup;
915921
children = (
922+
9F76FFFE2B17884900962526 /* EmbeddedHelper.swift */,
916923
1CCA911F2A27FA8700AEA213 /* MiscEmbeddedClasses.swift */,
917924
1CCA91212A28075A00AEA213 /* EmbeddedSessionManager.swift */,
918925
551FA75D2988AC930072D0A9 /* EmptyEmbeddedManager.swift */,
@@ -960,6 +967,24 @@
960967
path = "swift-sdk/misc";
961968
sourceTree = "<group>";
962969
};
970+
55684317298C8036006A5EB4 /* embedded-messaging-tests */ = {
971+
isa = PBXGroup;
972+
children = (
973+
55684318298C8052006A5EB4 /* EmbeddedManagerTests.swift */,
974+
553449A229C26A95002E4599 /* EmbeddedMessagingProcessorTests.swift */,
975+
55C87D33299EE633002013D0 /* EmbeddedMessagingSerializationTests.swift */,
976+
);
977+
path = "embedded-messaging-tests";
978+
sourceTree = "<group>";
979+
};
980+
560ACF442A308C8A007F9503 /* uicomponents */ = {
981+
isa = PBXGroup;
982+
children = (
983+
560ACF462A308C8A007F9503 /* IterableBannerView.swift */,
984+
);
985+
path = uicomponents;
986+
sourceTree = "<group>";
987+
};
963988
AC0248062279132400495FB9 /* Dwifft */ = {
964989
isa = PBXGroup;
965990
children = (
@@ -1019,9 +1044,10 @@
10191044
AC2263E120CF49B8009800EB /* swift-sdk */ = {
10201045
isa = PBXGroup;
10211046
children = (
1047+
AC44C0EB22615F8100E0641D /* Resources */,
1048+
560ACF442A308C8A007F9503 /* uicomponents */,
10221049
AC5C467E2756AEA4000762B6 /* swiftui */,
10231050
AC72A0BB20CF4C8C004D7997 /* Internal */,
1024-
AC44C0EB22615F8100E0641D /* Resources */,
10251051
AC2263F920CF4B63009800EB /* Supporting Files */,
10261052
AC72A0C120CF4CB8004D7997 /* CommerceItem.swift */,
10271053
AC72A0BE20CF4CB8004D7997 /* Constants.swift */,
@@ -1182,6 +1208,7 @@
11821208
AC44C0EB22615F8100E0641D /* Resources */ = {
11831209
isa = PBXGroup;
11841210
children = (
1211+
560ACF452A308C8A007F9503 /* IterableBannerView.xib */,
11851212
AC219C522260006600B98631 /* Assets.xcassets */,
11861213
AC50865224C60172001DC132 /* IterableDataModel.xcdatamodeld */,
11871214
AC219C4F225FEDBD00B98631 /* SampleInboxCell.xib */,
@@ -1914,6 +1941,7 @@
19141941
isa = PBXResourcesBuildPhase;
19151942
buildActionMask = 2147483647;
19161943
files = (
1944+
564BCC302A30B60500A699B9 /* IterableBannerView.xib in Resources */,
19171945
AC219C532260006600B98631 /* Assets.xcassets in Resources */,
19181946
AC219C51225FEDBD00B98631 /* SampleInboxCell.xib in Resources */,
19191947
);
@@ -2014,6 +2042,7 @@
20142042
buildActionMask = 2147483647;
20152043
files = (
20162044
1CCA91222A28075A00AEA213 /* EmbeddedSessionManager.swift in Sources */,
2045+
9F76FFFF2B17884900962526 /* EmbeddedHelper.swift in Sources */,
20172046
1CCA91202A27FA8700AEA213 /* MiscEmbeddedClasses.swift in Sources */,
20182047
AC31B042232AB53500BE25EB /* InboxImpressionTracker.swift in Sources */,
20192048
55D54656239AE5750093ED1E /* IterableLogUtil.swift in Sources */,
@@ -2045,6 +2074,7 @@
20452074
AC684A86222EF75C00F29749 /* InAppMessageParser.swift in Sources */,
20462075
AC72A0C920CF4CE2004D7997 /* IterableAction.swift in Sources */,
20472076
AC72A0CA20CF4CE2004D7997 /* ActionRunner.swift in Sources */,
2077+
560ACF482A308C8A007F9503 /* IterableBannerView.swift in Sources */,
20482078
ACC3FDB1253724DB0004A2E0 /* InAppCalculations.swift in Sources */,
20492079
ACD6116C2107D004003E7F6B /* NetworkHelper.swift in Sources */,
20502080
ACC362B624D16D91002C67BA /* IterableRequest.swift in Sources */,
@@ -2807,7 +2837,7 @@
28072837
CODE_SIGN_STYLE = Automatic;
28082838
DEVELOPMENT_TEAM = BP98Z28R86;
28092839
INFOPLIST_FILE = "Tests/unit-tests/Info.plist";
2810-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
2840+
IPHONEOS_DEPLOYMENT_TARGET = 13.6;
28112841
LD_RUNPATH_SEARCH_PATHS = (
28122842
"$(inherited)",
28132843
"@executable_path/Frameworks",
@@ -2827,7 +2857,7 @@
28272857
CODE_SIGN_STYLE = Automatic;
28282858
DEVELOPMENT_TEAM = BP98Z28R86;
28292859
INFOPLIST_FILE = "Tests/unit-tests/Info.plist";
2830-
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
2860+
IPHONEOS_DEPLOYMENT_TARGET = 13.6;
28312861
LD_RUNPATH_SEARCH_PATHS = (
28322862
"$(inherited)",
28332863
"@executable_path/Frameworks",

0 commit comments

Comments
 (0)