Skip to content

Commit 00aea2e

Browse files
domeniconicoliAndrewSB
authored andcommitted
Removed deprecated API method and code warning, updated to Swift 5 (#141)
* -Removed deprecated API method -Update to Swift 5 version -Removed many code warnings
1 parent 18d6109 commit 00aea2e

File tree

7 files changed

+41
-56
lines changed

7 files changed

+41
-56
lines changed

ZLSwipeableViewSwift/ZLSwipeableView.swift

-45
Original file line numberDiff line numberDiff line change
@@ -350,51 +350,6 @@ extension ZLSwipeableView {
350350

351351
}
352352

353-
// MARK: - Deprecated APIs
354-
extension ZLSwipeableView {
355-
356-
@available(*, deprecated: 1, message: "Use numberOfActiveView")
357-
public var numPrefetchedViews: UInt {
358-
get {
359-
return numberOfActiveView
360-
}
361-
set(newValue){
362-
numberOfActiveView = newValue
363-
}
364-
}
365-
366-
@available(*, deprecated: 1, message: "Use allowedDirection")
367-
public var direction: Direction {
368-
get {
369-
return allowedDirection
370-
}
371-
set(newValue){
372-
allowedDirection = newValue
373-
}
374-
}
375-
376-
@available(*, deprecated: 1, message: "Use minTranslationInPercent")
377-
public var translationThreshold: CGFloat {
378-
get {
379-
return minTranslationInPercent
380-
}
381-
set(newValue){
382-
minTranslationInPercent = newValue
383-
}
384-
}
385-
386-
@available(*, deprecated: 1, message: "Use minVelocityInPointPerSecond")
387-
public var velocityThreshold: CGFloat {
388-
get {
389-
return minVelocityInPointPerSecond
390-
}
391-
set(newValue){
392-
minVelocityInPointPerSecond = newValue
393-
}
394-
}
395-
396-
}
397-
398353
// MARK: - Helper extensions
399354
public func *(lhs: CGPoint, rhs: CGFloat) -> CGPoint {
400355
return CGPoint(x: lhs.x * rhs, y: lhs.y * rhs)

ZLSwipeableViewSwiftDemo/Pods/Cartography/Cartography/Constrain.swift

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ZLSwipeableViewSwiftDemo/Pods/Cartography/Cartography/LayoutSupport.swift

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ZLSwipeableViewSwiftDemo/ZLSwipeableViewSwiftDemo.xcodeproj/project.pbxproj

+35-5
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
isa = PBXProject;
252252
attributes = {
253253
LastSwiftUpdateCheck = 0700;
254-
LastUpgradeCheck = 0730;
254+
LastUpgradeCheck = 1100;
255255
ORGANIZATIONNAME = "Zhixuan Lai";
256256
TargetAttributes = {
257257
09673A7D1AEF5B2E008C7240 = {
@@ -270,6 +270,7 @@
270270
developmentRegion = English;
271271
hasScannedForEncodings = 0;
272272
knownRegions = (
273+
English,
273274
en,
274275
Base,
275276
);
@@ -456,17 +457,28 @@
456457
isa = XCBuildConfiguration;
457458
buildSettings = {
458459
ALWAYS_SEARCH_USER_PATHS = NO;
460+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
459461
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
460462
CLANG_CXX_LIBRARY = "libc++";
461463
CLANG_ENABLE_MODULES = YES;
462464
CLANG_ENABLE_OBJC_ARC = YES;
465+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
463466
CLANG_WARN_BOOL_CONVERSION = YES;
467+
CLANG_WARN_COMMA = YES;
464468
CLANG_WARN_CONSTANT_CONVERSION = YES;
469+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
465470
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
466471
CLANG_WARN_EMPTY_BODY = YES;
467472
CLANG_WARN_ENUM_CONVERSION = YES;
473+
CLANG_WARN_INFINITE_RECURSION = YES;
468474
CLANG_WARN_INT_CONVERSION = YES;
475+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
476+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
477+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
469478
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
479+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
480+
CLANG_WARN_STRICT_PROTOTYPES = YES;
481+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
470482
CLANG_WARN_UNREACHABLE_CODE = YES;
471483
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
472484
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -501,17 +513,28 @@
501513
isa = XCBuildConfiguration;
502514
buildSettings = {
503515
ALWAYS_SEARCH_USER_PATHS = NO;
516+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
504517
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
505518
CLANG_CXX_LIBRARY = "libc++";
506519
CLANG_ENABLE_MODULES = YES;
507520
CLANG_ENABLE_OBJC_ARC = YES;
521+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
508522
CLANG_WARN_BOOL_CONVERSION = YES;
523+
CLANG_WARN_COMMA = YES;
509524
CLANG_WARN_CONSTANT_CONVERSION = YES;
525+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
510526
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
511527
CLANG_WARN_EMPTY_BODY = YES;
512528
CLANG_WARN_ENUM_CONVERSION = YES;
529+
CLANG_WARN_INFINITE_RECURSION = YES;
513530
CLANG_WARN_INT_CONVERSION = YES;
531+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
532+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
533+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
514534
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
535+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
536+
CLANG_WARN_STRICT_PROTOTYPES = YES;
537+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
515538
CLANG_WARN_UNREACHABLE_CODE = YES;
516539
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
517540
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -530,6 +553,7 @@
530553
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
531554
MTL_ENABLE_DEBUG_INFO = NO;
532555
SDKROOT = iphoneos;
556+
SWIFT_COMPILATION_MODE = wholemodule;
533557
VALIDATE_PRODUCT = YES;
534558
};
535559
name = Release;
@@ -538,37 +562,41 @@
538562
isa = XCBuildConfiguration;
539563
baseConfigurationReference = 4BA34855EB4A4C2074C86E94 /* Pods-ZLSwipeableViewSwiftDemo.debug.xcconfig */;
540564
buildSettings = {
565+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
541566
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
542567
DEVELOPMENT_TEAM = "";
543568
INFOPLIST_FILE = ZLSwipeableViewSwiftDemo/Info.plist;
544569
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
545570
PRODUCT_BUNDLE_IDENTIFIER = "com.axcel.$(PRODUCT_NAME:rfc1034identifier)";
546571
PRODUCT_NAME = "$(TARGET_NAME)";
547572
SWIFT_SWIFT3_OBJC_INFERENCE = On;
548-
SWIFT_VERSION = 4.0;
573+
SWIFT_VERSION = 5.0;
549574
};
550575
name = Debug;
551576
};
552577
09673A9F1AEF5B2E008C7240 /* Release */ = {
553578
isa = XCBuildConfiguration;
554579
baseConfigurationReference = 4AEF23DC622C3A7E809F3742 /* Pods-ZLSwipeableViewSwiftDemo.release.xcconfig */;
555580
buildSettings = {
581+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
556582
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
557583
DEVELOPMENT_TEAM = "";
558584
INFOPLIST_FILE = ZLSwipeableViewSwiftDemo/Info.plist;
559585
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
560586
PRODUCT_BUNDLE_IDENTIFIER = "com.axcel.$(PRODUCT_NAME:rfc1034identifier)";
561587
PRODUCT_NAME = "$(TARGET_NAME)";
562588
SWIFT_SWIFT3_OBJC_INFERENCE = On;
563-
SWIFT_VERSION = 4.0;
589+
SWIFT_VERSION = 5.0;
564590
};
565591
name = Release;
566592
};
567593
09673AA11AEF5B2E008C7240 /* Debug */ = {
568594
isa = XCBuildConfiguration;
569595
baseConfigurationReference = E98741382FDFBC754EDA0B1E /* Pods-ZLSwipeableViewSwiftDemoTests.debug.xcconfig */;
570596
buildSettings = {
597+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
571598
BUNDLE_LOADER = "$(TEST_HOST)";
599+
DEVELOPMENT_TEAM = "";
572600
FRAMEWORK_SEARCH_PATHS = (
573601
"$(SDKROOT)/Developer/Library/Frameworks",
574602
"$(inherited)",
@@ -582,7 +610,7 @@
582610
PRODUCT_BUNDLE_IDENTIFIER = "com.axcel.$(PRODUCT_NAME:rfc1034identifier)";
583611
PRODUCT_NAME = "$(TARGET_NAME)";
584612
SWIFT_SWIFT3_OBJC_INFERENCE = On;
585-
SWIFT_VERSION = 4.0;
613+
SWIFT_VERSION = 5.0;
586614
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZLSwipeableViewSwiftDemo.app/ZLSwipeableViewSwiftDemo";
587615
};
588616
name = Debug;
@@ -591,7 +619,9 @@
591619
isa = XCBuildConfiguration;
592620
baseConfigurationReference = C998BF9C49543ECF772E8671 /* Pods-ZLSwipeableViewSwiftDemoTests.release.xcconfig */;
593621
buildSettings = {
622+
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
594623
BUNDLE_LOADER = "$(TEST_HOST)";
624+
DEVELOPMENT_TEAM = "";
595625
FRAMEWORK_SEARCH_PATHS = (
596626
"$(SDKROOT)/Developer/Library/Frameworks",
597627
"$(inherited)",
@@ -601,7 +631,7 @@
601631
PRODUCT_BUNDLE_IDENTIFIER = "com.axcel.$(PRODUCT_NAME:rfc1034identifier)";
602632
PRODUCT_NAME = "$(TARGET_NAME)";
603633
SWIFT_SWIFT3_OBJC_INFERENCE = On;
604-
SWIFT_VERSION = 4.0;
634+
SWIFT_VERSION = 5.0;
605635
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZLSwipeableViewSwiftDemo.app/ZLSwipeableViewSwiftDemo";
606636
};
607637
name = Release;

ZLSwipeableViewSwiftDemo/ZLSwipeableViewSwiftDemo/AppDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1414
var window: UIWindow?
1515

1616

17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1818
window = UIWindow(frame: UIScreen.main.bounds)
1919
if let window = window {
2020
let menuViewController = MenuTableViewController(style: .grouped)

ZLSwipeableViewSwiftDemo/ZLSwipeableViewSwiftDemo/CustomAnimationDemoViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CustomAnimationDemoViewController: ZLSwipeableViewController {
1313
override func viewDidLoad() {
1414
super.viewDidLoad()
1515
func toRadian(_ degree: CGFloat) -> CGFloat {
16-
return degree * CGFloat(M_PI/180)
16+
return degree * CGFloat(Double.pi/180)
1717
}
1818
func rotateAndTranslateView(_ view: UIView, forDegree degree: CGFloat, translation: CGPoint, duration: TimeInterval, offsetFromCenter offset: CGPoint, swipeableView: ZLSwipeableView) {
1919
UIView.animate(withDuration: duration, delay: 0, options: .allowUserInteraction, animations: {

ZLSwipeableViewSwiftDemo/ZLSwipeableViewSwiftDemo/PreviousViewDemoViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PreviousViewDemoViewController: ZLSwipeableViewController {
4646
let distance = max(width, height)
4747

4848
func randomRadian() -> CGFloat {
49-
return CGFloat(arc4random() % 360) * CGFloat(M_PI / 180)
49+
return CGFloat(arc4random() % 360) * CGFloat(Double.pi / 180)
5050
}
5151

5252
var transform = CGAffineTransform(rotationAngle: randomRadian())

0 commit comments

Comments
 (0)