Skip to content

Commit

Permalink
support swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
diyaa-hamza authored and MoathOthman committed Oct 24, 2018
1 parent d55a29f commit 4be0b86
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
EC5B8FE71EE0ECA4003BE809 = {
CreatedOnToolsVersion = 8.3.2;
DevelopmentTeam = 5YP97VN386;
LastSwiftMigration = 0930;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -329,8 +329,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whitetorch.LocalizationHelperDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -343,8 +342,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.whitetorch.LocalizationHelperDemo;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Release;
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, MOLHResetable {

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.
MOLH.shared.activate(true)
MOLH.shared.specialKeyWords = ["Cancel","Done"]
Expand Down
22 changes: 11 additions & 11 deletions MOLH/MOLH.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ open class MOLH {
reset app which will perform transition and call reset on appdelegate if it's MOLHResetable
*/
open class func reset() {
var transition = UIViewAnimationOptions.transitionFlipFromRight
var transition = UIView.AnimationOptions.transitionFlipFromRight
if !MOLHLanguage.isRTLLanguage() {
transition = .transitionFlipFromLeft
}
reset(transition: transition)
}

open class func reset(transition: UIViewAnimationOptions) {
open class func reset(transition: UIView.AnimationOptions) {
if let delegate = UIApplication.shared.delegate {
if delegate is MOLHResetable {
(delegate as!MOLHResetable).reset()
Expand Down Expand Up @@ -197,7 +197,7 @@ extension Bundle {
extension UIImage {
public func flippedImage() -> UIImage?{
if let _cgImag = self.cgImage {
let flippedimg = UIImage(cgImage: _cgImag, scale:self.scale , orientation: UIImageOrientation.upMirrored)
let flippedimg = UIImage(cgImage: _cgImag, scale:self.scale , orientation: UIImage.Orientation.upMirrored)
return flippedimg
}
return nil
Expand Down Expand Up @@ -244,20 +244,20 @@ extension UIViewController {
// Flip UISlider thumb image
if subView.isKind(of: UISlider.self) {
let toRightArrow = subView as! UISlider
let _img = toRightArrow.thumbImage(for: UIControlState())
let _img = toRightArrow.thumbImage(for: UIControl.State())
let flipped = _img?.flipIfNeeded()
toRightArrow.setThumbImage(flipped, for: UIControlState())
toRightArrow.setThumbImage(flipped, for: UIControl.State())
toRightArrow.setThumbImage(flipped, for: .selected)
toRightArrow.setThumbImage(flipped, for: .highlighted)
}
// Flip UIButton image
if subView.isKind(of: UIButton.self) {
let _subView = subView as! UIButton
var image = _subView.image(for: UIControlState())
var image = _subView.image(for: UIControl.State())
image = image?.flippedImage()
_subView.setImage(image, for: UIControlState())
_subView.setImage(image, for: UIControlState.selected)
_subView.setImage(image, for: UIControlState.highlighted)
_subView.setImage(image, for: UIControl.State())
_subView.setImage(image, for: UIControl.State.selected)
_subView.setImage(image, for: UIControl.State.highlighted)
}

loopThroughSubViewAndFlipTheImageIfItsNeeded(subView.subviews)
Expand Down Expand Up @@ -300,8 +300,8 @@ extension UITextField: TextViewType {
}

func listenToKeyboard() {
NotificationCenter.default.removeObserver(self, name: .UITextInputCurrentInputModeDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(inputModeDidChange), name: .UITextInputCurrentInputModeDidChange, object: nil)
NotificationCenter.default.removeObserver(self, name: UITextInputMode.currentInputModeDidChangeNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(inputModeDidChange), name: UITextInputMode.currentInputModeDidChangeNotification, object: nil)
}

@objc func inputModeDidChange(_ notification: Notification) {
Expand Down

0 comments on commit 4be0b86

Please sign in to comment.