Skip to content

Commit

Permalink
refactor(sdk): support Swift 5
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyamjain65 authored and Varun Malhotra committed Jan 28, 2022
1 parent 97af013 commit 961e32b
Show file tree
Hide file tree
Showing 17 changed files with 160 additions and 91 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ DerivedData
*.xcuserstate
Pods/
Carthage/
SocketIO.framework/
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "socketio/socket.io-client-swift" ~> 13.1.0
github "socketio/socket.io-client-swift" ~> 15.2.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "daltoniam/Starscream" "3.1.1"
github "socketio/socket.io-client-swift" "v13.4.0"
github "socketio/socket.io-client-swift" "v15.2.0"
5 changes: 2 additions & 3 deletions Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ target 'VWO Demo' do
use_frameworks!
#pod 'VWO', '~> 2.7.1'
pod 'VWO', :path => '../'
# pod 'FLEX', '~> 2.0', :configurations => ['Debug']
pod 'SCLAlertView'
pod 'MBProgressHUD', '~> 1.1.0'
pod 'SCLAlertView', '~> 0.8'
pod 'MBProgressHUD', '~> 1.1.0'

end
24 changes: 12 additions & 12 deletions Demo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PODS:
- MBProgressHUD (1.1.0)
- SCLAlertView (0.8)
- Socket.IO-Client-Swift (13.4.0):
- Starscream (~> 3.0.2)
- Starscream (3.0.6)
- VWO (2.7.1):
- VWO/All (= 2.7.1)
- VWO/All (2.7.1):
- Socket.IO-Client-Swift (~> 13.1)
- Socket.IO-Client-Swift (15.2.0):
- Starscream (~> 3.1)
- Starscream (3.1.1)
- VWO (2.8.0):
- VWO/All (= 2.8.0)
- VWO/All (2.8.0):
- Socket.IO-Client-Swift (~> 15.2.0)

DEPENDENCIES:
- MBProgressHUD (~> 1.1.0)
- SCLAlertView
- SCLAlertView (~> 0.8)
- VWO (from `../`)

SPEC REPOS:
Expand All @@ -28,10 +28,10 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
SCLAlertView: 6a77bb2edfc65e04dbe57725546cb4107a506b85
Socket.IO-Client-Swift: 2b2720f14c92ff1237ced09bc2f2da2022624fee
Starscream: ef3ece99d765eeccb67de105bfa143f929026cf5
VWO: f7cfcc0df231c378eed8d8088d30babf456ccc9c
Socket.IO-Client-Swift: 1e3e3a1f09f3312a167f0d781eb2f383d477357c
Starscream: 4bb2f9942274833f7b4d296a55504dcfc7edb7b0
VWO: c12710457497bc88cdca575bd3151e246ac5a57c

PODFILE CHECKSUM: 2b2638e9e63d49ba40c6ab42dfe34e64a8745537
PODFILE CHECKSUM: 71bfa555223ee2b1ddab35d14fef462b5e6267e6

COCOAPODS: 1.10.2
6 changes: 2 additions & 4 deletions Demo/VWO Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
880EA21C25AC2FAB00A129D3 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
880EA21F25AC2FB000A129D3 /* Starscream.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Starscream.framework; sourceTree = BUILT_PRODUCTS_DIR; };
880EA22225AC2FB400A129D3 /* VWO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = VWO.framework; sourceTree = BUILT_PRODUCTS_DIR; };
88A772532678BEF400DAC487 /* UserExperiorSDK.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = UserExperiorSDK.xcframework; path = Pods/UserExperior/UserExperiorSDK.xcframework; sourceTree = "<group>"; };
8FAF68EB5053737B941C0877 /* Pods_VWO_Demo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_VWO_Demo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BB5B8FB3D715DA6E51505A25 /* Pods-VWO Demo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VWO Demo.release.xcconfig"; path = "Pods/Target Support Files/Pods-VWO Demo/Pods-VWO Demo.release.xcconfig"; sourceTree = "<group>"; };
E29775C6CEE32F6DD028E06B /* Pods-VWO Demo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-VWO Demo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-VWO Demo/Pods-VWO Demo.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -155,7 +154,6 @@
E34D6BE11F7E512F0094A905 /* Frameworks */ = {
isa = PBXGroup;
children = (
88A772532678BEF400DAC487 /* UserExperiorSDK.xcframework */,
880EA22225AC2FB400A129D3 /* VWO.framework */,
880EA21F25AC2FB000A129D3 /* Starscream.framework */,
880EA21C25AC2FAB00A129D3 /* SocketIO.framework */,
Expand Down Expand Up @@ -520,7 +518,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.wingify.abtestapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG VWO_DEBUG";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -540,7 +538,7 @@
MARKETING_VERSION = 1.3.7;
PRODUCT_BUNDLE_IDENTIFIER = com.wingify.abtestapp;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion Demo/VWO Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let phoneNav = UIStoryboard.main.instantiate(identifier: "phoneNav") as UINavigationController
let houseNav = UIStoryboard.main.instantiate(identifier: "houseNav") as UINavigationController

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// setCurrentViewController(vc: houseNav)
setCurrentViewController(vc: phoneNav)
return true
Expand Down
46 changes: 23 additions & 23 deletions Demo/VWO Demo/SlideMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct SlideMenuOptions {
public static var shadowOffset: CGSize = CGSize(width: 0, height: 0)
public static var panFromBezel: Bool = true
public static var animationDuration: CGFloat = 0.4
public static var animationOptions: UIViewAnimationOptions = []
public static var animationOptions: UIView.AnimationOptions = []
public static var rightViewWidth: CGFloat = 270.0
public static var rightBezelWidth: CGFloat? = 16.0
public static var rightPanFromBezel: Bool = true
Expand Down Expand Up @@ -128,7 +128,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
opacityframe.size.height = opacityframe.size.height - opacityOffset
opacityView = UIView(frame: opacityframe)
opacityView.backgroundColor = SlideMenuOptions.opacityViewBackgroundColor
opacityView.autoresizingMask = [UIViewAutoresizing.flexibleHeight, UIViewAutoresizing.flexibleWidth]
opacityView.autoresizingMask = [UIView.AutoresizingMask.flexibleHeight, UIView.AutoresizingMask.flexibleWidth]
opacityView.layer.opacity = 0.0
view.insertSubview(opacityView, at: 1)

Expand All @@ -141,7 +141,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
leftFrame.size.height = leftFrame.size.height - leftOffset
leftContainerView = UIView(frame: leftFrame)
leftContainerView.backgroundColor = UIColor.clear
leftContainerView.autoresizingMask = UIViewAutoresizing.flexibleHeight
leftContainerView.autoresizingMask = UIView.AutoresizingMask.flexibleHeight
view.insertSubview(leftContainerView, at: 2)
addLeftGestures()
}
Expand All @@ -155,7 +155,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
rightFrame.size.height = rightFrame.size.height - rightOffset
rightContainerView = UIView(frame: rightFrame)
rightContainerView.backgroundColor = UIColor.clear
rightContainerView.autoresizingMask = UIViewAutoresizing.flexibleHeight
rightContainerView.autoresizingMask = UIView.AutoresizingMask.flexibleHeight
view.insertSubview(rightContainerView, at: 3)
addRightGestures()
}
Expand Down Expand Up @@ -356,7 +356,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
static var startPointOfPan: CGPoint = CGPoint.zero
static var wasOpenAtStartOfPan: Bool = false
static var wasHiddenAtStartOfPan: Bool = false
static var lastState : UIGestureRecognizerState = .ended
static var lastState : UIGestureRecognizer.State = .ended
}

@objc func handleLeftPanGesture(_ panGesture: UIPanGestureRecognizer) {
Expand All @@ -370,7 +370,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}

switch panGesture.state {
case UIGestureRecognizerState.began:
case UIGestureRecognizer.State.began:
if LeftPanState.lastState != .ended && LeftPanState.lastState != .cancelled && LeftPanState.lastState != .failed {
return
}
Expand All @@ -389,7 +389,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
leftViewController?.beginAppearanceTransition(LeftPanState.wasHiddenAtStartOfPan, animated: true)
addShadowToView(leftContainerView)
setOpenWindowLevel()
case UIGestureRecognizerState.changed:
case UIGestureRecognizer.State.changed:
if LeftPanState.lastState != .began && LeftPanState.lastState != .changed {
return
}
Expand All @@ -398,7 +398,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
leftContainerView.frame = applyLeftTranslation(translation, toFrame: LeftPanState.frameAtStartOfPan)
applyLeftOpacity()
applyLeftContentViewScale()
case UIGestureRecognizerState.ended, UIGestureRecognizerState.cancelled:
case UIGestureRecognizer.State.ended, UIGestureRecognizer.State.cancelled:
if LeftPanState.lastState != .changed {
setCloseWindowLevel()
return
Expand All @@ -424,7 +424,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
track(.leftFlickClose)

}
case UIGestureRecognizerState.failed, UIGestureRecognizerState.possible:
case UIGestureRecognizer.State.failed, UIGestureRecognizer.State.possible:
break
}

Expand All @@ -436,7 +436,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
static var startPointOfPan: CGPoint = CGPoint.zero
static var wasOpenAtStartOfPan: Bool = false
static var wasHiddenAtStartOfPan: Bool = false
static var lastState : UIGestureRecognizerState = .ended
static var lastState : UIGestureRecognizer.State = .ended
}

@objc func handleRightPanGesture(_ panGesture: UIPanGestureRecognizer) {
Expand All @@ -450,7 +450,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
}

switch panGesture.state {
case UIGestureRecognizerState.began:
case UIGestureRecognizer.State.began:
if RightPanState.lastState != .ended && RightPanState.lastState != .cancelled && RightPanState.lastState != .failed {
return
}
Expand All @@ -470,7 +470,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {

addShadowToView(rightContainerView)
setOpenWindowLevel()
case UIGestureRecognizerState.changed:
case UIGestureRecognizer.State.changed:
if RightPanState.lastState != .began && RightPanState.lastState != .changed {
return
}
Expand All @@ -480,7 +480,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
applyRightOpacity()
applyRightContentViewScale()

case UIGestureRecognizerState.ended, UIGestureRecognizerState.cancelled:
case UIGestureRecognizer.State.ended, UIGestureRecognizer.State.cancelled:
if RightPanState.lastState != .changed {
setCloseWindowLevel()
return
Expand All @@ -505,7 +505,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {

track(.rightFlickClose)
}
case UIGestureRecognizerState.failed, UIGestureRecognizerState.possible:
case UIGestureRecognizer.State.failed, UIGestureRecognizer.State.possible:
break
}

Expand Down Expand Up @@ -900,7 +900,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
if SlideMenuOptions.hideStatusBar {
DispatchQueue.main.async(execute: {
if let window = UIApplication.shared.keyWindow {
window.windowLevel = UIWindowLevelStatusBar + 1
window.windowLevel = UIWindow.Level.statusBar + 1
}
})
}
Expand All @@ -910,7 +910,7 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
if SlideMenuOptions.hideStatusBar {
DispatchQueue.main.async(execute: {
if let window = UIApplication.shared.keyWindow {
window.windowLevel = UIWindowLevelNormal
window.windowLevel = UIWindow.Level.normal
}
})
}
Expand All @@ -920,10 +920,10 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
if let viewController = targetViewController {
viewController.view.frame = targetView.bounds

if (!childViewControllers.contains(viewController)) {
addChildViewController(viewController)
if (!children.contains(viewController)) {
addChild(viewController)
targetView.addSubview(viewController.view)
viewController.didMove(toParentViewController: self)
viewController.didMove(toParent: self)
}
}
}
Expand All @@ -932,9 +932,9 @@ open class SlideMenuController: UIViewController, UIGestureRecognizerDelegate {
fileprivate func removeViewController(_ viewController: UIViewController?) {
if let _viewController = viewController {
_viewController.view.layer.removeAllAnimations()
_viewController.willMove(toParentViewController: nil)
_viewController.willMove(toParent: nil)
_viewController.view.removeFromSuperview()
_viewController.removeFromParentViewController()
_viewController.removeFromParent()
}
}

Expand Down Expand Up @@ -1042,12 +1042,12 @@ extension UIViewController {
}

public func addLeftBarButtonWithImage(_ buttonImage: UIImage) {
let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.toggleLeft))
let leftButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.toggleLeft))
navigationItem.leftBarButtonItem = leftButton
}

public func addRightBarButtonWithImage(_ buttonImage: UIImage) {
let rightButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.toggleRight))
let rightButton: UIBarButtonItem = UIBarButtonItem(image: buttonImage, style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.toggleRight))
navigationItem.rightBarButtonItem = rightButton
}

Expand Down
2 changes: 1 addition & 1 deletion Demo/VWO Demo/VWOManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class VWOManager {
let config = VWOConfig()
// config.setCustomDimension(customDimensionKey: "userId", customDimensionValue: "userName")
config.userID = "userId"
config.isChinaCDN = false
// config.isChinaCDN = false
VWO.launch(apiKey: apiKey, config: config, completion: {
DispatchQueue.main.async {
// VWO.pushCustomDimension(customDimensionKey: "userId", customDimensionValue: "userName")
Expand Down
2 changes: 1 addition & 1 deletion Demo/VWO Demo/Variable campaign/HouseCollectionVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class HouseCollectionVC: UICollectionViewController {

override func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
//////////////////////// HEADER ///////////////////////////////////////
let headerCell = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "asd", for: indexPath) as! SectionHeader
let headerCell = collectionView.dequeueReusableSupplementaryView(ofKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "asd", for: indexPath) as! SectionHeader
headerCell.textLabel.text = "\(indexPath.section + 1) BHK Flats Apartments near you"

return headerCell
Expand Down
6 changes: 3 additions & 3 deletions VWO.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "VWO"
s.version = "2.8.0"
s.version = "2.9.0"
s.summary = "VWO SDK for A/B Testing iOS apps."
s.description = "VWO iOS SDK enables you to A/B test mobile apps."
s.documentation_url = "http://developers.vwo.com/reference#ios-sdk-reference"
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/wingify/vwo-ios-sdk.git",
:tag => s.version.to_s }
s.platform = :ios, '9.0'
s.swift_version = '4.0'
s.swift_version = '5.0'
s.default_subspec = 'All'

s.subspec 'Core' do |ss|
Expand All @@ -20,6 +20,6 @@ Pod::Spec.new do |s|

s.subspec 'All' do |ss|
ss.source_files = 'Socket/**/*.{m,h}', 'VWO/**/*.{m,h}'
ss.dependency 'Socket.IO-Client-Swift', '~> 13.1'
ss.dependency 'Socket.IO-Client-Swift', '~> 15.2.0'
end
end
Loading

0 comments on commit 961e32b

Please sign in to comment.