Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted to Swift 5 #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions AlertOnboarding.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = CookMinute;
TargetAttributes = {
37845A641D994CBA009B3734 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = N7MCZ8UJRF;
LastSwiftMigration = 1100;
ProvisioningStyle = Automatic;
};
};
Expand All @@ -125,6 +127,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -191,20 +194,30 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -242,20 +255,30 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -286,25 +309,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = N7MCZ8UJRF;
INFOPLIST_FILE = AlertOnboarding/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cookminute.AlertOnboarding;
PRODUCT_BUNDLE_IDENTIFIER = com.Tsarshah.AlertOnboarding;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
37845A791D994CBA009B3734 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = N7MCZ8UJRF;
INFOPLIST_FILE = AlertOnboarding/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.cookminute.AlertOnboarding;
PRODUCT_BUNDLE_IDENTIFIER = com.Tsarshah.AlertOnboarding;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
10 changes: 5 additions & 5 deletions AlertOnboarding/AlertOnboarding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate {
//Update Color
self.buttonBottom.backgroundColor = colorButtonBottomBackground
self.backgroundColor = colorForAlertViewBackground
self.buttonBottom.setTitleColor(colorButtonText, for: UIControlState())
self.buttonBottom.setTitle(self.titleSkipButton, for: UIControlState())
self.buttonBottom.setTitleColor(colorButtonText, for: UIControl.State())
self.buttonBottom.setTitle(self.titleSkipButton, for: UIControl.State())

self.container = AlertPageViewController(arrayOfImage: arrayOfImage, arrayOfTitle: arrayOfTitle, arrayOfDescription: arrayOfDescription, alertView: self)
self.container.delegate = self
Expand Down Expand Up @@ -200,7 +200,7 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate {
}

fileprivate func animateForEnding(){
UIView.animate(withDuration: 0.2, delay: 0.0, options: UIViewAnimationOptions.curveEaseOut, animations: {
UIView.animate(withDuration: 0.2, delay: 0.0, options: UIView.AnimationOptions.curveEaseOut, animations: {
self.alpha = 0.0
}, completion: {
(finished: Bool) -> Void in
Expand All @@ -209,7 +209,7 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate {
() -> Void in
self.background.removeFromSuperview()
self.removeFromSuperview()
self.container.removeFromParentViewController()
self.container.removeFromParent()
self.container.view.removeFromSuperview()
}
})
Expand Down Expand Up @@ -239,7 +239,7 @@ open class AlertOnboarding: UIView, AlertPageViewDelegate {
//MARK: NOTIFICATIONS PROCESS ------------------------------------------
fileprivate func interceptOrientationChange(){
UIDevice.current.beginGeneratingDeviceOrientationNotifications()
NotificationCenter.default.addObserver(self, selector: #selector(AlertOnboarding.onOrientationChange), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(AlertOnboarding.onOrientationChange), name: UIDevice.orientationDidChangeNotification, object: nil)
}

@objc func onOrientationChange(){
Expand Down
10 changes: 5 additions & 5 deletions AlertOnboarding/AlertPageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource,
self.view.backgroundColor = UIColor.clear
self.view.addSubview(self.pageController.view)
self.view.addSubview(self.pageControl)
self.pageController.didMove(toParentViewController: self)
self.pageController.didMove(toParent: self)
}

override func viewWillAppear(_ animated: Bool) {
Expand Down Expand Up @@ -140,9 +140,9 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource,
if pageControl != nil {
pageControl.currentPage = arrayOfImage.count - index! - 1
if pageControl.currentPage == arrayOfImage.count - 1 {
self.alertview.buttonBottom.setTitle(alertview.titleGotItButton, for: UIControlState())
self.alertview.buttonBottom.setTitle(alertview.titleGotItButton, for: UIControl.State())
} else {
self.alertview.buttonBottom.setTitle(alertview.titleSkipButton, for: UIControlState())
self.alertview.buttonBottom.setTitle(alertview.titleSkipButton, for: UIControl.State())
}
}
}
Expand Down Expand Up @@ -170,7 +170,7 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource,
}

fileprivate func configurePageViewController(){
self.pageController = UIPageViewController(transitionStyle: UIPageViewControllerTransitionStyle.scroll, navigationOrientation: UIPageViewControllerNavigationOrientation.horizontal, options: nil)
self.pageController = UIPageViewController(transitionStyle: UIPageViewController.TransitionStyle.scroll, navigationOrientation: UIPageViewController.NavigationOrientation.horizontal, options: nil)
self.pageController.view.backgroundColor = UIColor.clear

if #available(iOS 9.0, *) {
Expand All @@ -189,7 +189,7 @@ class AlertPageViewController: UIViewController, UIPageViewControllerDataSource,
self.viewControllers = [initialViewController!]
self.pageController.setViewControllers(viewControllers, direction: .forward, animated: false, completion: nil)

self.addChildViewController(self.pageController)
self.addChild(self.pageController)
}

//MARK: Called after notification orientation changement
Expand Down
2 changes: 1 addition & 1 deletion AlertOnboarding/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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.
return true
}
Expand Down
2 changes: 0 additions & 2 deletions AlertOnboarding/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
Expand Down