Commit ef06acfd by Daniel Dahan

issue-44: updated for swift 2.0

parent 4f2d6628
...@@ -458,7 +458,7 @@ ...@@ -458,7 +458,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
...@@ -500,7 +500,7 @@ ...@@ -500,7 +500,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.3;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos; SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import UIKit import UIKit
public class BasicCardView : MaterialCardView, Comparable, Equatable { public class BasicCardView : MaterialCardView, Comparable {
// //
// :name: layoutConstraints // :name: layoutConstraints
// //
...@@ -319,15 +319,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable { ...@@ -319,15 +319,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
*/ */
public var leftButtons: Array<MaterialButton>? { public var leftButtons: Array<MaterialButton>? {
didSet { didSet {
if let b = leftButtons { if nil == rightButtons && nil == leftButtons {
if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
}
} else {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
} else if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
} }
prepareCard() prepareCard()
} }
...@@ -338,15 +336,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable { ...@@ -338,15 +336,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
*/ */
public var rightButtons: Array<MaterialButton>? { public var rightButtons: Array<MaterialButton>? {
didSet { didSet {
if let b = rightButtons { if nil == rightButtons && nil == leftButtons {
if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
}
} else {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
} else if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
} }
prepareCard() prepareCard()
} }
...@@ -497,10 +493,16 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable { ...@@ -497,10 +493,16 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
NSLayoutConstraint.activateConstraints(layoutConstraints) NSLayoutConstraint.activateConstraints(layoutConstraints)
} }
} }
}
/**
public func ==(lhs: BasicCardView, rhs: BasicCardView) -> Bool { :name: isEqual
return lhs.tag == rhs.tag */
public override func isEqual(object: AnyObject?) -> Bool {
if let rhs = object as? BasicCardView {
return tag == rhs.tag
}
return false
}
} }
public func <=(lhs: BasicCardView, rhs: BasicCardView) -> Bool { public func <=(lhs: BasicCardView, rhs: BasicCardView) -> Bool {
......
...@@ -97,11 +97,9 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -97,11 +97,9 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
public func prepareSession(preset: String = AVCaptureSessionPresetHigh) -> Bool { public func prepareSession(preset: String = AVCaptureSessionPresetHigh) -> Bool {
session.sessionPreset = preset session.sessionPreset = preset
var error: NSError?
// setup default camera device // setup default camera device
let videoDevice: AVCaptureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo) let videoDevice: AVCaptureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo)
let videoInput: AVCaptureDeviceInput? = AVCaptureDeviceInput.deviceInputWithDevice(videoDevice) as? AVCaptureDeviceInput let videoInput: AVCaptureDeviceInput? = try? AVCaptureDeviceInput(device: videoDevice)
if nil == videoInput { if nil == videoInput {
return false return false
...@@ -113,7 +111,7 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -113,7 +111,7 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
} }
let audioDevice: AVCaptureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeAudio) let audioDevice: AVCaptureDevice = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeAudio)
let audioInput: AVCaptureDeviceInput? = AVCaptureDeviceInput.deviceInputWithDevice(audioDevice) as? AVCaptureDeviceInput let audioInput: AVCaptureDeviceInput? = try? AVCaptureDeviceInput(device: audioDevice)
if nil == audioInput { if nil == audioInput {
return false return false
...@@ -218,9 +216,8 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -218,9 +216,8 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
return false return false
} }
let error: NSError?
let videoDevice: AVCaptureDevice? = inactiveCamera let videoDevice: AVCaptureDevice? = inactiveCamera
let videoInput: AVCaptureDeviceInput? = AVCaptureDeviceInput.deviceInputWithDevice(videoDevice) as? AVCaptureDeviceInput let videoInput: AVCaptureDeviceInput? = try? AVCaptureDeviceInput(device: videoDevice)
if nil == videoInput { if nil == videoInput {
session.beginConfiguration() session.beginConfiguration()
...@@ -234,7 +231,7 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -234,7 +231,7 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
session.commitConfiguration() session.commitConfiguration()
} else { } else {
delegate?.captureDeviceConfigurationFailed?(self, error: error) delegate?.captureDeviceConfigurationFailed?(self, error: nil)
return false return false
} }
...@@ -391,14 +388,14 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -391,14 +388,14 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
let device: AVCaptureDevice = object as! AVCaptureDevice let device: AVCaptureDevice = object as! AVCaptureDevice
if device.adjustingExposure && device.isExposureModeSupported(.Locked) { if device.adjustingExposure && device.isExposureModeSupported(.Locked) {
object.removeObserver(self, forKeyPath: "adjustingExposure", context: &CaptureAdjustingExposureContext) object!.removeObserver(self, forKeyPath: "adjustingExposure", context: &CaptureAdjustingExposureContext)
dispatch_async(queue) { dispatch_async(queue) {
var error: NSError? var error: NSError?
do { do {
try device.lockForConfiguration() try device.lockForConfiguration()
device.unlockForConfiguration() device.unlockForConfiguration()
} catch var error1 as NSError { } catch let e as NSError {
error = error1 error = e
self.delegate?.captureDeviceConfigurationFailed?(self, error: error) self.delegate?.captureDeviceConfigurationFailed?(self, error: error)
} catch { } catch {
fatalError() fatalError()
...@@ -560,15 +557,12 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -560,15 +557,12 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
* @return An optional NSURL value. * @return An optional NSURL value.
*/ */
private var uniqueURL: NSURL? { private var uniqueURL: NSURL? {
var error: NSError?
let fileManager: NSFileManager = NSFileManager.defaultManager() let fileManager: NSFileManager = NSFileManager.defaultManager()
let tempDirectoryTemplate: String = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("FocusLibrary") let tempDirectoryTemplate: String = (NSTemporaryDirectory() as NSString).stringByAppendingPathComponent("FocusLibrary")
do { do {
try fileManager.createDirectoryAtPath(tempDirectoryTemplate, withIntermediateDirectories: true, attributes: nil) try fileManager.createDirectoryAtPath(tempDirectoryTemplate, withIntermediateDirectories: true, attributes: nil)
return NSURL.fileURLWithPath(tempDirectoryTemplate + "/test.mov") return NSURL.fileURLWithPath(tempDirectoryTemplate + "/test.mov")
} catch let error1 as NSError { } catch {}
error = error1
}
return nil return nil
} }
...@@ -630,17 +624,19 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate { ...@@ -630,17 +624,19 @@ public class Capture: NSObject, AVCaptureFileOutputRecordingDelegate {
*/ */
private func generateThumbnailForVideoAtURL(videoURL: NSURL!) { private func generateThumbnailForVideoAtURL(videoURL: NSURL!) {
dispatch_async(queue) { dispatch_async(queue) {
let asset: AVAsset = AVAsset.assetWithURL(videoURL) do {
let imageGenerator: AVAssetImageGenerator = AVAssetImageGenerator(asset: asset) let asset: AVAsset = AVAsset(URL: videoURL)
imageGenerator.maximumSize = CGSizeMake(100, 0) let imageGenerator: AVAssetImageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true imageGenerator.maximumSize = CGSizeMake(100, 0)
imageGenerator.appliesPreferredTrackTransform = true
let imageRef: CGImageRef = try? imageGenerator.copyCGImageAtTime(kCMTimeZero, actualTime: nil)
let image: UIImage = UIImage(CGImage: imageRef) let imageRef: CGImageRef = try imageGenerator.copyCGImageAtTime(kCMTimeZero, actualTime: nil)
let image: UIImage = UIImage(CGImage: imageRef)
dispatch_async(dispatch_get_main_queue()) {
self.postAssetLibraryNotification(image) dispatch_async(dispatch_get_main_queue()) {
} self.postAssetLibraryNotification(image)
}
} catch {}
} }
} }
......
...@@ -41,7 +41,7 @@ public class FabButton : MaterialButton { ...@@ -41,7 +41,7 @@ public class FabButton : MaterialButton {
// //
// :name: pulseBegan // :name: pulseBegan
// //
internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent?) {
super.pulseBegan(touches, withEvent: event) super.pulseBegan(touches, withEvent: event)
UIView.animateWithDuration(0.3, animations: { UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(3, 3) self.pulseView!.transform = CGAffineTransformMakeScale(3, 3)
......
...@@ -42,7 +42,7 @@ public class FlatButton : MaterialButton { ...@@ -42,7 +42,7 @@ public class FlatButton : MaterialButton {
// //
// :name: pulseBegan // :name: pulseBegan
// //
internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent?) {
super.pulseBegan(touches, withEvent: event) super.pulseBegan(touches, withEvent: event)
UIView.animateWithDuration(0.3, animations: { UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(4, 4) self.pulseView!.transform = CGAffineTransformMakeScale(4, 4)
......
...@@ -429,15 +429,13 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -429,15 +429,13 @@ public class ImageCardView : MaterialCardView, Comparable {
*/ */
public var leftButtons: Array<MaterialButton>? { public var leftButtons: Array<MaterialButton>? {
didSet { didSet {
if let b = leftButtons { if nil == rightButtons && nil == leftButtons {
if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
}
} else {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
} else if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
} }
prepareCard() prepareCard()
} }
...@@ -448,15 +446,13 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -448,15 +446,13 @@ public class ImageCardView : MaterialCardView, Comparable {
*/ */
public var rightButtons: Array<MaterialButton>? { public var rightButtons: Array<MaterialButton>? {
didSet { didSet {
if let b = rightButtons { if nil == rightButtons && nil == leftButtons {
if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
}
} else {
buttonsContainer?.removeFromSuperview() buttonsContainer?.removeFromSuperview()
} else if nil == buttonsContainer {
buttonsContainer = UIView()
buttonsContainer!.translatesAutoresizingMaskIntoConstraints = false
buttonsContainer!.backgroundColor = MaterialTheme.clear.color
addSubview(buttonsContainer!)
} }
prepareCard() prepareCard()
} }
...@@ -630,10 +626,16 @@ public class ImageCardView : MaterialCardView, Comparable { ...@@ -630,10 +626,16 @@ public class ImageCardView : MaterialCardView, Comparable {
NSLayoutConstraint.activateConstraints(layoutConstraints) NSLayoutConstraint.activateConstraints(layoutConstraints)
} }
} }
}
/**
public func ==(lhs: ImageCardView, rhs: ImageCardView) -> Bool { :name: isEqual
return lhs.tag == rhs.tag */
public override func isEqual(object: AnyObject?) -> Bool {
if let rhs = object as? ImageCardView {
return tag == rhs.tag
}
return false
}
} }
public func <=(lhs: ImageCardView, rhs: ImageCardView) -> Bool { public func <=(lhs: ImageCardView, rhs: ImageCardView) -> Bool {
......
...@@ -142,9 +142,6 @@ public struct Layout { ...@@ -142,9 +142,6 @@ public struct Layout {
:name: constraint :name: constraint
*/ */
public static func constraint(format: String, options: NSLayoutFormatOptions, metrics: Dictionary<String, AnyObject>?, views: Dictionary<String, AnyObject>) -> Array<NSLayoutConstraint> { public static func constraint(format: String, options: NSLayoutFormatOptions, metrics: Dictionary<String, AnyObject>?, views: Dictionary<String, AnyObject>) -> Array<NSLayoutConstraint> {
for (_, v) in views {
v.setTranslatesAutoresizingMaskIntoConstraints(false)
}
return NSLayoutConstraint.constraintsWithVisualFormat( return NSLayoutConstraint.constraintsWithVisualFormat(
format, format,
options: options, options: options,
......
...@@ -129,7 +129,7 @@ public class MaterialButton : UIButton { ...@@ -129,7 +129,7 @@ public class MaterialButton : UIButton {
// //
// :name: pulseBegan // :name: pulseBegan
// //
internal func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent?) {
pulseView = UIView(frame: CGRectMake(0, 0, bounds.height, bounds.height)) pulseView = UIView(frame: CGRectMake(0, 0, bounds.height, bounds.height))
pulseView!.layer.cornerRadius = bounds.height / 2 pulseView!.layer.cornerRadius = bounds.height / 2
pulseView!.center = (touches.first as! UITouch).locationInView(self) pulseView!.center = (touches.first as! UITouch).locationInView(self)
...@@ -140,7 +140,7 @@ public class MaterialButton : UIButton { ...@@ -140,7 +140,7 @@ public class MaterialButton : UIButton {
// //
// :name: pulseEnded // :name: pulseEnded
// //
internal func pulseEnded(touches: Set<NSObject>, withEvent event: UIEvent) { internal func pulseEnded(touches: Set<NSObject>?, withEvent event: UIEvent?) {
UIView.animateWithDuration(0.3, UIView.animateWithDuration(0.3,
animations: { _ in animations: { _ in
self.pulseView?.alpha = 0 self.pulseView?.alpha = 0
......
...@@ -21,7 +21,7 @@ import UIKit ...@@ -21,7 +21,7 @@ import UIKit
@objc(MaterialTextDelegate) @objc(MaterialTextDelegate)
public protocol TextDelegate { public protocol TextDelegate {
optional func textStorageWillProcessEdit(text: MaterialText, textStorage: MaterialTextStorage, string: String, range: NSRange) optional func textStorageWillProcessEdit(text: MaterialText, textStorage: MaterialTextStorage, string: String, range: NSRange)
optional func textStorageDidProcessEdit(text: MaterialText, textStorage: MaterialTextStorage, string: String, result: NSTextCheckingResult, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) optional func textStorageDidProcessEdit(text: MaterialText, textStorage: MaterialTextStorage, string: String, result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>)
} }
@objc(MaterialText) @objc(MaterialText)
...@@ -60,7 +60,7 @@ public class MaterialText: NSObject { ...@@ -60,7 +60,7 @@ public class MaterialText: NSObject {
textStorage.textStorageWillProcessEdit = { (textStorage: MaterialTextStorage, string: String, range: NSRange) -> Void in textStorage.textStorageWillProcessEdit = { (textStorage: MaterialTextStorage, string: String, range: NSRange) -> Void in
self.delegate?.textStorageWillProcessEdit?(self, textStorage: textStorage, string: string, range: range) self.delegate?.textStorageWillProcessEdit?(self, textStorage: textStorage, string: string, range: range)
} }
textStorage.textStorageDidProcessEdit = { (textStorage: MaterialTextStorage, result: NSTextCheckingResult, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in textStorage.textStorageDidProcessEdit = { (textStorage: MaterialTextStorage, result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
self.delegate?.textStorageDidProcessEdit?(self, textStorage: textStorage, string: textStorage.string, result: result, flags: flags, stop: stop) self.delegate?.textStorageDidProcessEdit?(self, textStorage: textStorage, string: textStorage.string, result: result, flags: flags, stop: stop)
} }
} }
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
import UIKit import UIKit
internal typealias MaterialTextStorageWillProcessEdit = (MaterialTextStorage, String, NSRange) -> Void internal typealias MaterialTextStorageWillProcessEdit = (MaterialTextStorage, String, NSRange) -> Void
internal typealias MaterialTextStorageDidProcessEdit = (MaterialTextStorage, NSTextCheckingResult, NSMatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void internal typealias MaterialTextStorageDidProcessEdit = (MaterialTextStorage, NSTextCheckingResult?, NSMatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void
public class MaterialTextStorage: NSTextStorage { public class MaterialTextStorage: NSTextStorage {
/** /**
...@@ -48,11 +48,17 @@ public class MaterialTextStorage: NSTextStorage { ...@@ -48,11 +48,17 @@ public class MaterialTextStorage: NSTextStorage {
*/ */
internal var textStorageDidProcessEdit: MaterialTextStorageDidProcessEdit? internal var textStorageDidProcessEdit: MaterialTextStorageDidProcessEdit?
required public init?(coder aDecoder: NSCoder) { /**
:name: init
*/
public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
} }
override public init() { /**
:name: init
*/
public override init() {
super.init() super.init()
} }
...@@ -66,25 +72,37 @@ public class MaterialTextStorage: NSTextStorage { ...@@ -66,25 +72,37 @@ public class MaterialTextStorage: NSTextStorage {
} }
} }
override public func processEditing() { /**
:name: processEditing
*/
public override func processEditing() {
let range: NSRange = (string as NSString).paragraphRangeForRange(editedRange) let range: NSRange = (string as NSString).paragraphRangeForRange(editedRange)
textStorageWillProcessEdit?(self, string, range) textStorageWillProcessEdit?(self, string, range)
searchExpression!.enumerateMatchesInString(string, options: [], range: range) { (result: NSTextCheckingResult!, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) in searchExpression!.enumerateMatchesInString(string, options: [], range: range) { (result: NSTextCheckingResult?, flags: NSMatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
self.textStorageDidProcessEdit?(self, result, flags, stop) self.textStorageDidProcessEdit?(self, result, flags, stop)
} }
super.processEditing() super.processEditing()
} }
override public func attributesAtIndex(location: Int, effectiveRange range: NSRangePointer) -> [String : AnyObject] { /**
:name: attributesAtIndex
*/
public override func attributesAtIndex(location: Int, effectiveRange range: NSRangePointer) -> [String : AnyObject] {
return store.attributesAtIndex(location, effectiveRange: range) return store.attributesAtIndex(location, effectiveRange: range)
} }
override public func replaceCharactersInRange(range: NSRange, withString str: String) { /**
:name: replaceCharactersInRange
*/
public override func replaceCharactersInRange(range: NSRange, withString str: String) {
store.replaceCharactersInRange(range, withString: str) store.replaceCharactersInRange(range, withString: str)
edited(NSTextStorageEditActions.EditedCharacters, range: range, changeInLength: str.utf16.count - range.length) edited(NSTextStorageEditActions.EditedCharacters, range: range, changeInLength: str.utf16.count - range.length)
} }
override public func setAttributes(attrs: [String : AnyObject]?, range: NSRange) { /**
:name: setAttributes
*/
public override func setAttributes(attrs: [String : AnyObject]?, range: NSRange) {
store.setAttributes(attrs, range: range) store.setAttributes(attrs, range: range)
edited(NSTextStorageEditActions.EditedAttributes, range: range, changeInLength: 0) edited(NSTextStorageEditActions.EditedAttributes, range: range, changeInLength: 0)
} }
......
...@@ -42,7 +42,7 @@ public class RaisedButton : MaterialButton { ...@@ -42,7 +42,7 @@ public class RaisedButton : MaterialButton {
// //
// :name: pulseBegan // :name: pulseBegan
// //
internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent) { internal override func pulseBegan(touches: Set<NSObject>, withEvent event: UIEvent?) {
super.pulseBegan(touches, withEvent: event) super.pulseBegan(touches, withEvent: event)
UIView.animateWithDuration(0.3, animations: { UIView.animateWithDuration(0.3, animations: {
self.pulseView!.transform = CGAffineTransformMakeScale(4, 4) self.pulseView!.transform = CGAffineTransformMakeScale(4, 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment