Skip to content

Commit 9b8fad7

Browse files
authored
Merge pull request #3 from fermoya/feat/update-swift5
Update Swift5
2 parents d2f2ece + f1f7867 commit 9b8fad7

File tree

4 files changed

+46
-30
lines changed

4 files changed

+46
-30
lines changed

BubbleShowCase.framework.zip

1.54 MB
Binary file not shown.

BubbleShowCase/BubbleShowCase.xcodeproj/project.pbxproj

+7-4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
hasScannedForEncodings = 0;
109109
knownRegions = (
110110
en,
111+
Base,
111112
);
112113
mainGroup = B0EE5286213E89F7003E84EC;
113114
productRefGroup = B0EE5291213E89F7003E84EC /* Products */;
@@ -193,12 +194,13 @@
193194
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
194195
GCC_WARN_UNUSED_FUNCTION = YES;
195196
GCC_WARN_UNUSED_VARIABLE = YES;
196-
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
197+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
197198
MTL_ENABLE_DEBUG_INFO = YES;
198199
ONLY_ACTIVE_ARCH = YES;
199200
SDKROOT = iphoneos;
200201
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
201202
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
203+
SWIFT_VERSION = 5.0;
202204
VERSIONING_SYSTEM = "apple-generic";
203205
VERSION_INFO_PREFIX = "";
204206
};
@@ -250,11 +252,12 @@
250252
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
251253
GCC_WARN_UNUSED_FUNCTION = YES;
252254
GCC_WARN_UNUSED_VARIABLE = YES;
253-
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
255+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
254256
MTL_ENABLE_DEBUG_INFO = NO;
255257
SDKROOT = iphoneos;
256258
SWIFT_COMPILATION_MODE = wholemodule;
257259
SWIFT_OPTIMIZATION_LEVEL = "-O";
260+
SWIFT_VERSION = 5.0;
258261
VALIDATE_PRODUCT = YES;
259262
VERSIONING_SYSTEM = "apple-generic";
260263
VERSION_INFO_PREFIX = "";
@@ -283,7 +286,7 @@
283286
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
284287
SKIP_INSTALL = YES;
285288
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
286-
SWIFT_VERSION = 4.2;
289+
SWIFT_VERSION = 5.0;
287290
TARGETED_DEVICE_FAMILY = "1,2";
288291
};
289292
name = Debug;
@@ -309,7 +312,7 @@
309312
PRODUCT_BUNDLE_IDENTIFIER = "com.elconfidencial.BubbleShowCase-iOS";
310313
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
311314
SKIP_INSTALL = YES;
312-
SWIFT_VERSION = 4.2;
315+
SWIFT_VERSION = 5.0;
313316
TARGETED_DEVICE_FAMILY = "1,2";
314317
};
315318
name = Release;

BubbleShowCase/BubbleShowCase/BubbleShowCase.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "BubbleShowCase"
4-
s.version = "1.1.0"
4+
s.version = "1.2.0"
55
s.summary = "A wonderful way to show case your users your App features"
66

77
s.description = <<-DESC

BubbleShowCase/BubbleShowCase/BubbleShowCase.swift

+38-25
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ public class BubbleShowCase: UIView {
462462

463463
// Updates bubble top and bottom constraints to make fit the bubble into the screen. It should be called once the subviews have been rendered.
464464
private func updateSideConstraints() {
465+
guard let bubble = bubble else { return }
465466
let topAvailableSpace = screenshotContainer.frame.midY - margins
466467
let bottomAvailableSpace = screenWindow.frame.height - screenshotContainer.frame.midY - margins
467468
if topAvailableSpace < bubble.frame.height / 2 {
@@ -598,12 +599,15 @@ public class BubbleShowCase: UIView {
598599
bubbleTrailing?.constant = (bubbleTrailing?.constant ?? 0) - safeAreaMargins.left
599600
case .portraitUpsideDown, .faceUp, .faceDown, .unknown:
600601
break
602+
@unknown default:
603+
break
601604
}
602605
}
603606

604607
// Creates a button, draws a cross inside and places it at the top right of the bubble
605608
private func drawCross() {
606-
cross = UIButton()
609+
let cross = UIButton()
610+
self.cross = cross
607611
cross.addTarget(self, action: #selector(crossDidTap), for: .touchUpInside)
608612
cross.translatesAutoresizingMaskIntoConstraints = false
609613
bubble.addSubview(cross)
@@ -638,7 +642,8 @@ public class BubbleShowCase: UIView {
638642
private func drawArrow() {
639643
guard arrowDirection != .none else { return }
640644

641-
arrow = UIView()
645+
let arrow = UIView()
646+
self.arrow = arrow
642647
arrow.translatesAutoresizingMaskIntoConstraints = false
643648
bubble.addSubview(arrow)
644649

@@ -725,10 +730,10 @@ public class BubbleShowCase: UIView {
725730
arrow2.translatesAutoresizingMaskIntoConstraints = false
726731
bubble.addSubview(arrow2)
727732

728-
let bottom2 = NSLayoutConstraint(item: arrow2, attribute: .bottom, relatedBy: .equal, toItem: bubble, attribute: .bottom, multiplier: 1, constant: arrowSize)
729-
let centerX2 = NSLayoutConstraint(item: arrow2, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1, constant: -arrowSize)
730-
let height2 = NSLayoutConstraint(item: arrow2, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: arrowSize)
731-
let width2 = NSLayoutConstraint(item: arrow2, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: 2 * arrowSize)
733+
let bottom2 = NSLayoutConstraint(item: arrow2!, attribute: .bottom, relatedBy: .equal, toItem: bubble, attribute: .bottom, multiplier: 1, constant: arrowSize)
734+
let centerX2 = NSLayoutConstraint(item: arrow2!, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1, constant: -arrowSize)
735+
let height2 = NSLayoutConstraint(item: arrow2!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: arrowSize)
736+
let width2 = NSLayoutConstraint(item: arrow2!, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: 2 * arrowSize)
732737

733738
bubble.addConstraint(bottom2)
734739
addConstraint(centerX2)
@@ -758,10 +763,10 @@ public class BubbleShowCase: UIView {
758763
arrow2.translatesAutoresizingMaskIntoConstraints = false
759764
bubble.addSubview(arrow2)
760765

761-
let centerY2 = NSLayoutConstraint(item: arrow2, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: -arrowSize)
762-
let trailing2 = NSLayoutConstraint(item: arrow2, attribute: .trailing, relatedBy: .equal, toItem: bubble, attribute: .trailing, multiplier: 1, constant: arrowSize)
763-
let height2 = NSLayoutConstraint(item: arrow2, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: 2 * arrowSize)
764-
let width2 = NSLayoutConstraint(item: arrow2, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: arrowSize)
766+
let centerY2 = NSLayoutConstraint(item: arrow2!, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: -arrowSize)
767+
let trailing2 = NSLayoutConstraint(item: arrow2!, attribute: .trailing, relatedBy: .equal, toItem: bubble, attribute: .trailing, multiplier: 1, constant: arrowSize)
768+
let height2 = NSLayoutConstraint(item: arrow2!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: 2 * arrowSize)
769+
let width2 = NSLayoutConstraint(item: arrow2!, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: arrowSize)
765770

766771
bubble.addConstraint(trailing2)
767772
addConstraint(centerY2)
@@ -956,7 +961,8 @@ public class BubbleShowCase: UIView {
956961

957962
// Embeds the screenshot in the show case
958963
private func embedScreenshot() {
959-
screenshotContainer = UIView()
964+
let screenshotContainer = UIView()
965+
self.screenshotContainer = screenshotContainer
960966
screenshotContainer.translatesAutoresizingMaskIntoConstraints = false
961967
addSubview(screenshotContainer)
962968
addGestureRecognizersToScreenshot()
@@ -1037,7 +1043,8 @@ public class BubbleShowCase: UIView {
10371043

10381044
// Embeds the bubble in the show case view and places it next to the target according to the arrow direction
10391045
private func embedBubble() {
1040-
bubble = UIView()
1046+
let bubble = UIView()
1047+
self.bubble = bubble
10411048
bubble.layer.cornerRadius = 5
10421049
bubble.clipsToBounds = false
10431050
bubble.translatesAutoresizingMaskIntoConstraints = false
@@ -1057,7 +1064,8 @@ public class BubbleShowCase: UIView {
10571064
}
10581065

10591066
private func embedSkipButton() {
1060-
skipLabel = UILabel()
1067+
let skipLabel = UILabel()
1068+
self.skipLabel = skipLabel
10611069
skipLabel.textColor = UIColor.white
10621070
skipLabel.text = skipButtonText
10631071
skipLabel.textAlignment = .center
@@ -1079,7 +1087,6 @@ public class BubbleShowCase: UIView {
10791087

10801088
addConstraint(centerX)
10811089
addConstraint(bottom)
1082-
10831090
}
10841091

10851092
private func addGestureRecognizerToSkipButton() {
@@ -1095,6 +1102,7 @@ public class BubbleShowCase: UIView {
10951102

10961103
// Constraints the bubble to the target for both leftAndSide and upAndDown arrow directions
10971104
private func constraintBubbleForDoubleDirections() {
1105+
guard let bubble = bubble else { return }
10981106
let centerY = NSLayoutConstraint(item: bubble, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1, constant: 0)
10991107
let centerX = NSLayoutConstraint(item: bubble, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1, constant: 0)
11001108
addConstraints([centerY, centerX])
@@ -1112,6 +1120,7 @@ public class BubbleShowCase: UIView {
11121120

11131121
// Constraints the bubble to the target for both left and right arrow directions
11141122
private func contraintBubbleForSideDirections() {
1123+
guard let bubble = bubble else { return }
11151124
let centerY = NSLayoutConstraint(item: bubble, attribute: .centerY, relatedBy: .equal, toItem: screenshotContainer, attribute: .centerY, multiplier: 1, constant: 0)
11161125
addConstraint(centerY)
11171126
sideShowCaseCenterY = centerY
@@ -1143,6 +1152,7 @@ public class BubbleShowCase: UIView {
11431152

11441153
// Constraints the bubble to the target for both up and down arrow directions
11451154
private func constraintBubbleForTopDirections() {
1155+
guard let bubble = bubble else { return }
11461156
if arrowDirection == .up {
11471157
let topConstant = margins + padding
11481158
let top = NSLayoutConstraint(item: bubble, attribute: .top, relatedBy: .equal, toItem: screenshotContainer, attribute: .bottom, multiplier: 1, constant: topConstant)
@@ -1193,14 +1203,16 @@ public class BubbleShowCase: UIView {
11931203

11941204
// Embeds both the title and description into the show case
11951205
private func embedLabels() {
1196-
titleLabel = UILabel()
1206+
let titleLabel = UILabel()
1207+
self.titleLabel = titleLabel
11971208
titleLabel.numberOfLines = 0
11981209
titleLabel.text = titleText
11991210
titleLabel.font = titleFont
12001211
titleLabel.translatesAutoresizingMaskIntoConstraints = false
12011212
bubble.addSubview(titleLabel)
12021213

1203-
descriptionLabel = UILabel()
1214+
let descriptionLabel = UILabel()
1215+
self.descriptionLabel = descriptionLabel
12041216
descriptionLabel.numberOfLines = 0
12051217
descriptionLabel.text = descriptionText
12061218
descriptionLabel.font = descriptionFont
@@ -1222,20 +1234,21 @@ public class BubbleShowCase: UIView {
12221234

12231235
// Embeds the icon in the show case, shifting the labels rightwards
12241236
private func embedImage() {
1225-
icon = UIImageView(image: image)
1226-
icon?.translatesAutoresizingMaskIntoConstraints = false
1227-
bubble.addSubview(icon!)
1237+
let icon = UIImageView(image: image)
1238+
self.icon = icon
1239+
icon.translatesAutoresizingMaskIntoConstraints = false
1240+
bubble.addSubview(icon)
12281241

1229-
let height = NSLayoutConstraint(item: icon!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: imageSize.height)
1230-
let width = NSLayoutConstraint(item: icon!, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: imageSize.width)
1231-
icon?.addConstraints([height, width])
1242+
let height = NSLayoutConstraint(item: icon, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height, multiplier: 1, constant: imageSize.height)
1243+
let width = NSLayoutConstraint(item: icon, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .width, multiplier: 1, constant: imageSize.width)
1244+
icon.addConstraints([height, width])
12321245

1233-
let leading = NSLayoutConstraint(item: icon!, attribute: .leading, relatedBy: .equal, toItem: bubble, attribute: .leading, multiplier: 1, constant: bubblePadding.left)
1234-
let centerY = NSLayoutConstraint(item: icon!, attribute: .centerY, relatedBy: .equal, toItem: bubble, attribute: .centerY, multiplier: 1, constant: 0)
1246+
let leading = NSLayoutConstraint(item: icon, attribute: .leading, relatedBy: .equal, toItem: bubble, attribute: .leading, multiplier: 1, constant: bubblePadding.left)
1247+
let centerY = NSLayoutConstraint(item: icon, attribute: .centerY, relatedBy: .equal, toItem: bubble, attribute: .centerY, multiplier: 1, constant: 0)
12351248
bubble.addConstraints([leading, centerY])
12361249

12371250
bubble.removeConstraint(descriptionLeading)
1238-
descriptionLeading = NSLayoutConstraint(item: descriptionLabel, attribute: .leading, relatedBy: .equal, toItem: icon!, attribute: .trailing, multiplier: 1, constant: 15)
1251+
descriptionLeading = NSLayoutConstraint(item: descriptionLabel!, attribute: .leading, relatedBy: .equal, toItem: icon, attribute: .trailing, multiplier: 1, constant: 15)
12391252
bubble.addConstraint(descriptionLeading)
12401253
}
12411254

0 commit comments

Comments
 (0)