-
Notifications
You must be signed in to change notification settings - Fork 765
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #163 from christiancabarrocas/master
Swift 2.2 update - Color conversion refactor
- Loading branch information
Showing
5 changed files
with
116 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// | ||
// SCLExtensions.swift | ||
// SCLAlertView | ||
// | ||
// Created by Christian Cabarrocas on 16/04/16. | ||
// Copyright © 2016 Alexey Poimtsev. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension Int { | ||
|
||
func toUIColor() -> UIColor { | ||
return UIColor( | ||
red: CGFloat((self & 0xFF0000) >> 16) / 255.0, | ||
green: CGFloat((self & 0x00FF00) >> 8) / 255.0, | ||
blue: CGFloat(self & 0x0000FF) / 255.0, | ||
alpha: CGFloat(1.0) | ||
) | ||
} | ||
|
||
func toCGColor() -> CGColor { | ||
return self.toUIColor().CGColor | ||
} | ||
} | ||
|
||
extension UInt { | ||
|
||
func toUIColor() -> UIColor { | ||
return UIColor( | ||
red: CGFloat((self & 0xFF0000) >> 16) / 255.0, | ||
green: CGFloat((self & 0x00FF00) >> 8) / 255.0, | ||
blue: CGFloat(self & 0x0000FF) / 255.0, | ||
alpha: CGFloat(1.0) | ||
) | ||
} | ||
|
||
func toCGColor() -> CGColor { | ||
return self.toUIColor().CGColor | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// | ||
// SCLPublicConstructorsTest.swift | ||
// SCLAlertView | ||
// | ||
// Created by Christian Cabarrocas on 26/03/16. | ||
// Copyright © 2016 Alexey Poimtsev. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
class SCLPublicConstructorsTest: XCTestCase { | ||
|
||
override func setUp() { | ||
super.setUp() | ||
} | ||
|
||
override func tearDown() { | ||
super.tearDown() | ||
} | ||
|
||
func testShowSuccess() { | ||
let image = UIImage() | ||
let alert = SCLAlertView() | ||
let successReturn = alert.showSuccess("testTitle", subTitle: "testSubTitle", closeButtonTitle: "testClosebutton", duration: 1.0, colorStyle: 1, colorTextButton: 1, circleIconImage: image) | ||
XCTAssertNotNil(successReturn) | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
/* | ||
public func showSuccess(title: String, subTitle: String, closeButtonTitle:String?=nil, duration:NSTimeInterval=0.0, colorStyle: UInt=SCLAlertViewStyle.Success.defaultColorInt, colorTextButton: UInt=0xFFFFFF, circleIconImage: UIImage? = nil) -> SCLAlertViewResponder { | ||
return showTitle(title, subTitle: subTitle, duration: duration, completeText:closeButtonTitle, style: .Success, colorStyle: colorStyle, colorTextButton: colorTextButton, circleIconImage: circleIconImage) | ||
} | ||
|
||
public class SCLAlertViewResponder { | ||
let alertview: SCLAlertView | ||
|
||
// Initialisation and Title/Subtitle/Close functions | ||
public init(alertview: SCLAlertView) { | ||
self.alertview = alertview | ||
} | ||
|
||
public func setTitle(title: String) { | ||
self.alertview.labelTitle.text = title | ||
} | ||
|
||
public func setSubTitle(subTitle: String) { | ||
self.alertview.viewText.text = subTitle | ||
} | ||
|
||
public func close() { | ||
self.alertview.hideView() | ||
} | ||
|
||
public func setDismissBlock(dismissBlock: DismissBlock) { | ||
self.alertview.dismissBlock = dismissBlock | ||
} | ||
*/ |