Skip to content

Commit

Permalink
Merge pull request #25 from OliverDobner/swift4
Browse files Browse the repository at this point in the history
Swift4
  • Loading branch information
GabrielAlva committed Apr 24, 2018
2 parents b6653bc + c1f8db4 commit b81d9ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
9 changes: 5 additions & 4 deletions SwiftPrompts.xcodeproj/project.pbxproj
Expand Up @@ -162,6 +162,7 @@
};
CDA6F5091CA293E9003CE0A2 = {
CreatedOnToolsVersion = 7.3;
LastSwiftMigration = 0930;
};
};
};
Expand Down Expand Up @@ -370,7 +371,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -390,7 +391,7 @@
PRODUCT_BUNDLE_IDENTIFIER = GabrielAlva.SwiftPrompts;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -402,7 +403,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "GabrielAlva.SwiftPrompts-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -414,7 +415,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "GabrielAlva.SwiftPrompts-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
4 changes: 2 additions & 2 deletions SwiftPrompts/SwiftPrompts.swift
Expand Up @@ -49,7 +49,7 @@ open class SwiftPrompts : NSObject {
let textStyle = NSMutableParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
textStyle.alignment = NSTextAlignment.center

let textFontAttributes = [NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: textSize)!, NSForegroundColorAttributeName: contentTxtColor, NSParagraphStyleAttributeName: textStyle]
let textFontAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: textSize)!, NSAttributedStringKey.foregroundColor: contentTxtColor, NSAttributedStringKey.paragraphStyle: textStyle]

let textTextHeight: CGFloat = NSString(string: promptText).boundingRect(with: CGSize(width: textRect.width, height: CGFloat.infinity), options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: textFontAttributes, context: nil).size.height
context?.saveGState()
Expand All @@ -72,7 +72,7 @@ open class SwiftPrompts : NSObject {
let text2Style = NSMutableParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle
text2Style.alignment = NSTextAlignment.center

let text2FontAttributes = [NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: headerSize)!, NSForegroundColorAttributeName: headerTxtColor, NSParagraphStyleAttributeName: text2Style]
let text2FontAttributes = [NSAttributedStringKey.font: UIFont(name: "HelveticaNeue-Light", size: headerSize)!, NSAttributedStringKey.foregroundColor: headerTxtColor, NSAttributedStringKey.paragraphStyle: text2Style]

let text2TextHeight: CGFloat = NSString(string: headerText).boundingRect(with: CGSize(width: text2Rect.width, height: CGFloat.infinity), options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes: text2FontAttributes, context: nil).size.height
context?.saveGState()
Expand Down
10 changes: 5 additions & 5 deletions SwiftPrompts/SwiftPromptsView.swift
Expand Up @@ -21,7 +21,7 @@ open class SwiftPromptsView: UIView {

//Variables for the background view
fileprivate var blurringLevel : CGFloat = 5.0
fileprivate var colorWithTransparency = UIColor(red: 255.0, green: 255.0, blue: 255.0, alpha: 0.64)
fileprivate var colorWithTransparency = UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.64)
fileprivate var enableBlurring : Bool = true
fileprivate var enableTransparencyWithColor : Bool = true

Expand Down Expand Up @@ -169,7 +169,7 @@ open class SwiftPromptsView: UIView {
self.layer.add(applicationLoadViewIn, forKey: kCATransitionReveal)
}

func panelButtonAction(_ sender:UIButton?) {
@objc func panelButtonAction(_ sender:UIButton?) {
switch (sender!.tag) {
case 1:
delegate?.clickedOnTheMainButton?()
Expand All @@ -183,14 +183,14 @@ open class SwiftPromptsView: UIView {
// MARK: - Helper Functions
func snapshot(_ view: UIView!) -> UIImage! {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, true, 0)
view.drawHierarchy(in: view.bounds, afterScreenUpdates: true)
view.layer.render(in: UIGraphicsGetCurrentContext()!)
let image : UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext();

return image;
}

open func dismissPrompt() {
@objc open func dismissPrompt() {
UIView.animate(withDuration: 0.6, animations: {
self.layer.opacity = 0.0
}, completion: {
Expand Down Expand Up @@ -274,7 +274,7 @@ open class SwiftPromptsView: UIView {
SwiftPrompts.drawSwiftPrompt(frame: self.bounds, backgroundColor: masterClass.promptBackgroundColor, headerBarColor: masterClass.promptHeaderBarColor, bottomBarColor: masterClass.promptBottomBarColor, headerTxtColor: masterClass.promptHeaderTxtColor, contentTxtColor: masterClass.promptContentTxtColor, outlineColor: masterClass.promptOutlineColor, topLineColor: masterClass.promptTopLineColor, bottomLineColor: masterClass.promptBottomLineColor, dismissIconButton: masterClass.promptDismissIconColor, promptText: masterClass.promptContentText, textSize: masterClass.promptContentTxtSize, topBarVisibility: masterClass.promptTopBarVisibility, bottomBarVisibility: masterClass.promptBottomBarVisibility, headerText: masterClass.promptHeader, headerSize: masterClass.promptHeaderTxtSize, topLineVisibility: masterClass.promptTopLineVisibility, bottomLineVisibility: masterClass.promptBottomLineVisibility, outlineVisibility: masterClass.promptOutlineVisibility, dismissIconVisibility: masterClass.promptDismissIconVisibility)
}

func detectPan(_ recognizer:UIPanGestureRecognizer)
@objc func detectPan(_ recognizer:UIPanGestureRecognizer)
{
if lastLocation==CGPoint.zero{
lastLocation = self.center
Expand Down

0 comments on commit b81d9ed

Please sign in to comment.