diff --git a/CardSlider.xcodeproj/project.pbxproj b/CardSlider.xcodeproj/project.pbxproj
index d0b7ee1..beccc3b 100644
--- a/CardSlider.xcodeproj/project.pbxproj
+++ b/CardSlider.xcodeproj/project.pbxproj
@@ -102,6 +102,7 @@
TargetAttributes = {
100D4D971E64C99D00486D7C = {
CreatedOnToolsVersion = 8.2.1;
+ DevelopmentTeam = FE73CQ8FQ2;
LastSwiftMigration = 0820;
ProvisioningStyle = Automatic;
};
@@ -112,6 +113,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
+ English,
en,
Base,
);
@@ -262,14 +264,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
- DEVELOPMENT_TEAM = "";
+ DEVELOPMENT_TEAM = FE73CQ8FQ2;
INFOPLIST_FILE = CardSlider/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = saoudrizwan.CardSlider;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -278,13 +280,13 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
- DEVELOPMENT_TEAM = "";
+ DEVELOPMENT_TEAM = FE73CQ8FQ2;
INFOPLIST_FILE = CardSlider/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = saoudrizwan.CardSlider;
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_VERSION = 5.0;
};
name = Release;
};
diff --git a/CardSlider.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/CardSlider.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 0000000..18d9810
--- /dev/null
+++ b/CardSlider.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/CardSlider.xcodeproj/project.xcworkspace/xcuserdata/macbookair.xcuserdatad/UserInterfaceState.xcuserstate b/CardSlider.xcodeproj/project.xcworkspace/xcuserdata/macbookair.xcuserdatad/UserInterfaceState.xcuserstate
new file mode 100644
index 0000000..1d70505
Binary files /dev/null and b/CardSlider.xcodeproj/project.xcworkspace/xcuserdata/macbookair.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/CardSlider.xcodeproj/xcuserdata/macbookair.xcuserdatad/xcschemes/xcschememanagement.plist b/CardSlider.xcodeproj/xcuserdata/macbookair.xcuserdatad/xcschemes/xcschememanagement.plist
new file mode 100644
index 0000000..02cd6df
--- /dev/null
+++ b/CardSlider.xcodeproj/xcuserdata/macbookair.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -0,0 +1,14 @@
+
+
+
+
+ SchemeUserState
+
+ CardSlider.xcscheme_^#shared#^_
+
+ orderHint
+ 0
+
+
+
+
diff --git a/CardSlider/AppDelegate.swift b/CardSlider/AppDelegate.swift
index b98318c..df37f3b 100644
--- a/CardSlider/AppDelegate.swift
+++ b/CardSlider/AppDelegate.swift
@@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let vc = ViewController()
diff --git a/CardSlider/ViewController.swift b/CardSlider/ViewController.swift
index 739c01d..aa06152 100644
--- a/CardSlider/ViewController.swift
+++ b/CardSlider/ViewController.swift
@@ -78,7 +78,7 @@ class ViewController: UIViewController {
}
// make sure that the first card in the deck is at the front
- self.view.bringSubview(toFront: cards[0])
+ self.view.bringSubviewToFront(cards[0])
}
/// This is called whenever the front card is swiped off the screen or is animating away from its initial position.
@@ -111,7 +111,7 @@ class ViewController: UIViewController {
// 2. add a new card (now the 4th card in the deck) to the very back
if 4 > (cards.count - 1) {
if cards.count != 1 {
- self.view.bringSubview(toFront: cards[1])
+ self.view.bringSubviewToFront(cards[1])
}
return
}
@@ -137,7 +137,7 @@ class ViewController: UIViewController {
})
// first card needs to be in the front for proper interactivity
- self.view.bringSubview(toFront: self.cards[1])
+ self.view.bringSubviewToFront(self.cards[1])
}
@@ -152,7 +152,7 @@ class ViewController: UIViewController {
var cardAttachmentBehavior: UIAttachmentBehavior!
/// This method handles the swiping gesture on each card and shows the appropriate emoji based on the card's center.
- func handleCardPan(sender: UIPanGestureRecognizer) {
+ @objc func handleCardPan(sender: UIPanGestureRecognizer) {
// if we're in the process of hiding a card, don't let the user interace with the cards yet
if cardIsHiding { return }
// change this to your discretion - it represents how far the user must pan up or down to change the option
@@ -165,7 +165,7 @@ class ViewController: UIViewController {
switch sender.state {
case .began:
dynamicAnimator.removeAllBehaviors()
- let offset = UIOffsetMake(panLocationInCard.x - cards[0].bounds.midX, panLocationInCard.y - cards[0].bounds.midY);
+ let offset = UIOffset(horizontal: panLocationInCard.x - cards[0].bounds.midX, vertical: panLocationInCard.y - cards[0].bounds.midY);
// card is attached to center
cardAttachmentBehavior = UIAttachmentBehavior(item: cards[0], offsetFromCenter: offset, attachedToAnchor: panLocationInView)
dynamicAnimator.addBehavior(cardAttachmentBehavior)