Commit 4ebb7ac7 by Daniel Dahan

updated to Xcode beta 4

parent d52f210d
......@@ -63,7 +63,7 @@ public struct Animation {
public static func delay(time: TimeInterval, completion: ()-> Void) -> AnimationDelayCancelBlock? {
func dispatch_later(completion: ()-> Void) {
DispatchQueue.main.after(when: DispatchTime.now() + time, execute: completion)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + time, execute: completion)
}
var cancelable: AnimationDelayCancelBlock?
......
......@@ -36,8 +36,8 @@ public class BottomNavigationFadeAnimatedTransitioning : NSObject, UIViewControl
let toView : UIView = transitionContext.view(forKey: UITransitionContextToViewKey)!
toView.alpha = 0
transitionContext.containerView().addSubview(fromView)
transitionContext.containerView().addSubview(toView)
transitionContext.containerView.addSubview(fromView)
transitionContext.containerView.addSubview(toView)
UIView.animate(withDuration: transitionDuration(using: transitionContext),
animations: { _ in
......
......@@ -119,10 +119,6 @@ public class Button: UIButton {
layoutShadowPath()
}
public override func alignmentRectInsets() -> UIEdgeInsets {
return UIEdgeInsets.zero
}
/**
Triggers the pulse animation.
- Parameter point: A Optional point to pulse from, otherwise pulses
......
......@@ -32,7 +32,7 @@ import UIKit
import AVFoundation
public class CapturePreview: View {
public override class func layerClass() -> AnyClass {
public override class var layerClass: AnyClass {
return AVCaptureVideoPreviewLayer.self
}
......
......@@ -69,6 +69,10 @@ public class CollectionViewLayout: UICollectionViewLayout {
/// Spacing between items.
public var interimSpace: InterimSpace = 0
public override var collectionViewContentSize: CGSize {
return contentSize
}
/**
Retrieves the index paths for the items within the passed in CGRect.
- Parameter rect: A CGRect that acts as the bounds to find the items within.
......@@ -113,10 +117,6 @@ public class CollectionViewLayout: UICollectionViewLayout {
return .vertical == scrollDirection ? newBounds.width != collectionView!.bounds.width : newBounds.height != collectionView!.bounds.height
}
public override func collectionViewContentSize() -> CGSize {
return contentSize
}
public override func prepare() {
if let dataSource: CollectionViewDataSource = collectionView?.dataSource as? CollectionViewDataSource {
prepareLayoutForItems(dataSourceItems: dataSource.items())
......
......@@ -32,13 +32,13 @@ import UIKit
public struct Color {
// clear
public static let clear: UIColor = UIColor.clear()
public static let clear: UIColor = UIColor.clear
// white
public static let white: UIColor = UIColor.white()
public static let white: UIColor = UIColor.white
// black
public static let black: UIColor = UIColor.black()
public static let black: UIColor = UIColor.black
// dark text
public struct darkText {
......
......@@ -30,7 +30,7 @@
import UIKit
public class ControlView : View {
public class ControlView: View {
/// Will render the view.
public var willRenderView: Bool {
return 0 < width && 0 < height
......@@ -73,6 +73,10 @@ public class ControlView : View {
}
}
public override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: 44)
}
/// Grid cell factor.
@IBInspectable public var gridFactor: CGFloat = 24 {
didSet {
......@@ -141,7 +145,7 @@ public class ControlView : View {
/// Basic initializer.
public init() {
super.init(frame: CGRect.zero)
frame.size = intrinsicContentSize()
frame.size = intrinsicContentSize
}
/**
......@@ -151,7 +155,7 @@ public class ControlView : View {
*/
public init(leftControls: [UIView]? = nil, rightControls: [UIView]? = nil) {
super.init(frame: CGRect.zero)
frame.size = intrinsicContentSize()
frame.size = intrinsicContentSize
prepareProperties(leftControls: leftControls, rightControls: rightControls)
}
......@@ -171,7 +175,7 @@ public class ControlView : View {
// leftControls
if let v = leftControls {
for c in v {
let w: CGFloat = c.intrinsicContentSize().width
let w: CGFloat = c.intrinsicContentSize.width
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero
c.frame.size.height = frame.size.height - contentInset.top - contentInset.bottom
......@@ -191,7 +195,7 @@ public class ControlView : View {
// rightControls
if let v = rightControls {
for c in v {
let w: CGFloat = c.intrinsicContentSize().width
let w: CGFloat = c.intrinsicContentSize.width
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero
c.frame.size.height = frame.size.height - contentInset.top - contentInset.bottom
......@@ -212,11 +216,7 @@ public class ControlView : View {
}
}
}
public override func intrinsicContentSize() -> CGSize {
return CGSize(width: width, height: 44)
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
......
......@@ -76,12 +76,12 @@ public struct Device {
/// Retrieves the current device type.
public static var userInterfaceIdiom: UIUserInterfaceIdiom {
return UIDevice.current().userInterfaceIdiom
return UIDevice.current.userInterfaceIdiom
}
/// A Boolean indicating if the device is in Landscape mode.
public static var isLandscape: Bool {
return UIApplication.shared().statusBarOrientation.isLandscape
return UIApplication.shared.statusBarOrientation.isLandscape
}
/// A Boolean indicating if the device is in Portrait mode.
......@@ -91,32 +91,32 @@ public struct Device {
/// The current UIInterfaceOrientation value.
public static var orientation: UIInterfaceOrientation {
return UIApplication.shared().statusBarOrientation
return UIApplication.shared.statusBarOrientation
}
/// Retrieves the device status bar style.
public static var statusBarStyle: UIStatusBarStyle {
get {
return UIApplication.shared().statusBarStyle
return UIApplication.shared.statusBarStyle
}
set(value) {
UIApplication.shared().statusBarStyle = value
UIApplication.shared.statusBarStyle = value
}
}
/// Retrieves the device status bar hidden state.
public static var isStatusBarHidden: Bool {
get {
return UIApplication.shared().isStatusBarHidden
return UIApplication.shared.isStatusBarHidden
}
set(value) {
UIApplication.shared().isStatusBarHidden = value
UIApplication.shared.isStatusBarHidden = value
}
}
/// Retrieves the device bounds.
public static var bounds: CGRect {
return UIScreen.main().bounds
return UIScreen.main.bounds
}
/// Retrieves the device width.
......@@ -131,6 +131,6 @@ public struct Device {
/// Retrieves the device scale.
public static var scale: CGFloat {
return UIScreen.main().scale
return UIScreen.main.scale
}
}
......@@ -86,7 +86,7 @@ private class FontLoader {
let bundle = Bundle(for: FontLoader.self)
let identifier = bundle.bundleIdentifier
let fontURL = true == identifier?.hasPrefix("org.cocoapods") ? bundle.urlForResource(name, withExtension: "ttf", subdirectory: "io.cosmicmind.material.fonts.bundle") : bundle.urlForResource(name, withExtension: "ttf")
let fontURL = true == identifier?.hasPrefix("org.cocoapods") ? bundle.url(forResource: name, withExtension: "ttf", subdirectory: "io.cosmicmind.material.fonts.bundle") : bundle.url(forResource: name, withExtension: "ttf")
if let v = fontURL {
let data = NSData(contentsOf: v as URL)!
......@@ -95,9 +95,9 @@ private class FontLoader {
var error: Unmanaged<CFError>?
if !CTFontManagerRegisterGraphicsFont(font, &error) {
let errorDescription: CFString = CFErrorCopyDescription(error!.takeUnretainedValue())
let nsError: NSError = error!.takeUnretainedValue() as AnyObject as! NSError
NSException(name: .internalInconsistencyException, reason: errorDescription as String, userInfo: [NSUnderlyingErrorKey: nsError]).raise()
let errorDescription = CFErrorCopyDescription(error!.takeUnretainedValue())
let nsError = error!.takeUnretainedValue() as AnyObject as! Error
NSException(name: .internalInconsistencyException, reason: errorDescription as? String, userInfo: [NSUnderlyingErrorKey: nsError as AnyObject]).raise()
}
}
}
......
......@@ -42,12 +42,10 @@ public struct Icon {
if nil == Icon.internalBundle {
Icon.internalBundle = Bundle(for: View.self)
let url = Icon.internalBundle!.resourceURL!
do {
let b = Bundle(url: try url.appendingPathComponent("io.cosmicmind.material.icons.bundle"))
if let v = b {
Icon.internalBundle = v
}
} catch {}
let b = Bundle(url: url.appendingPathComponent("io.cosmicmind.material.icons.bundle"))
if let v = b {
Icon.internalBundle = v
}
}
return Icon.internalBundle!
}
......
......@@ -106,13 +106,13 @@ public extension UIImage {
return nil
}
context.scale(x: 1.0, y: -1.0)
context.translate(x: 0.0, y: -size.height)
context.scaleBy(x: 1.0, y: -1.0)
context.translateBy(x: 0.0, y: -size.height)
context.setBlendMode(.multiply)
let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
context.clipToMask(rect, mask: cgImage!)
context.clip(to: rect, mask: cgImage!)
color.setFill()
context.fill(rect)
......@@ -185,8 +185,8 @@ public extension UIImage {
- Parameter completion: A completion block that is executed once the image
has been retrieved.
*/
public class func contentsOfURL(url: URL, completion: ((image: UIImage?, error: NSError?) -> Void)) {
URLSession.shared.dataTask(with: URLRequest(url: url)) { (data: Data?, response: URLResponse?, error: NSError?) in
public class func contentsOfURL(url: URL, completion: ((image: UIImage?, error: Error?) -> Void)) {
URLSession.shared.dataTask(with: URLRequest(url: url)) { (data: Data?, response: URLResponse?, error: Error?) in
DispatchQueue.main.async {
if let v = error {
completion(image: nil, error: v)
......@@ -215,25 +215,25 @@ public extension UIImage {
// Rotate if Left, Right, or Down.
switch imageOrientation {
case .down, .downMirrored:
transform = transform.translateBy(x: size.width, y: size.height)
transform = transform.rotate(CGFloat(M_PI))
transform = transform.translatedBy(x: size.width, y: size.height)
transform = transform.rotated(by: CGFloat(M_PI))
case .left, .leftMirrored:
transform = transform.translateBy(x: size.width, y: 0)
transform = transform.rotate(CGFloat(M_PI_2))
transform = transform.translatedBy(x: size.width, y: 0)
transform = transform.rotated(by: CGFloat(M_PI_2))
case .right, .rightMirrored:
transform = transform.translateBy(x: 0, y: size.height)
transform = transform.rotate(-CGFloat(M_PI_2))
transform = transform.translatedBy(x: 0, y: size.height)
transform = transform.rotated(by: -CGFloat(M_PI_2))
default:break
}
// Flip if mirrored.
switch imageOrientation {
case .upMirrored, .downMirrored:
transform = transform.translateBy(x: size.width, y: 0)
transform = transform.scaleBy(x: -1, y: 1)
transform = transform.translatedBy(x: size.width, y: 0)
transform = transform.scaledBy(x: -1, y: 1)
case .leftMirrored, .rightMirrored:
transform = transform.translateBy(x: size.height, y: 0)
transform = transform.scaleBy(x: -1, y: 1)
transform = transform.translatedBy(x: size.height, y: 0)
transform = transform.scaledBy(x: -1, y: 1)
default:break
}
......@@ -242,7 +242,7 @@ public extension UIImage {
return nil
}
context.concatCTM(transform)
context.concatenate(transform)
switch imageOrientation {
case .left, .leftMirrored, .right, .rightMirrored:
......
......@@ -35,7 +35,7 @@ public class MaterialLabel : UILabel {
/**
:name: layerClass
*/
public override class func layerClass() -> AnyClass {
public override class var layerClass: AnyClass {
return MaterialTextLayer.self
}
......
......@@ -52,6 +52,17 @@ public extension UINavigationBar {
@IBDesignable
public class NavigationBar: UINavigationBar {
public override var intrinsicContentSize: CGSize {
switch navigationBarStyle {
case .Tiny:
return CGSize(width: Device.width, height: 32)
case .Default:
return CGSize(width: Device.width, height: 44)
case .Medium:
return CGSize(width: Device.width, height: 56)
}
}
/// NavigationBarStyle value.
public var navigationBarStyle: NavigationBarStyle = .Default
......@@ -145,19 +156,8 @@ public class NavigationBar: UINavigationBar {
self.init(frame: CGRect.zero)
}
public override func intrinsicContentSize() -> CGSize {
switch navigationBarStyle {
case .Tiny:
return CGSize(width: Device.width, height: 32)
case .Default:
return CGSize(width: Device.width, height: 44)
case .Medium:
return CGSize(width: Device.width, height: 56)
}
}
public override func sizeThatFits(_ size: CGSize) -> CGSize {
return intrinsicContentSize()
return intrinsicContentSize
}
public override func layoutSublayers(of layer: CALayer) {
......@@ -200,7 +200,7 @@ public class NavigationBar: UINavigationBar {
let columns: Int = g + 1
titleView.frame.origin = CGPoint.zero
titleView.frame.size = intrinsicContentSize()
titleView.frame.size = intrinsicContentSize
titleView.grid.views = []
titleView.grid.axis.columns = columns
......@@ -209,7 +209,7 @@ public class NavigationBar: UINavigationBar {
// leftControls
if let v: Array<UIControl> = item.leftControls {
for c in v {
let w: CGFloat = c.intrinsicContentSize().width
let w: CGFloat = c.intrinsicContentSize.width
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero
c.frame.size.height = titleView.frame.size.height - contentInset.top - contentInset.bottom
......@@ -229,7 +229,7 @@ public class NavigationBar: UINavigationBar {
// rightControls
if let v: Array<UIControl> = item.rightControls {
for c in v {
let w: CGFloat = c.intrinsicContentSize().width
let w: CGFloat = c.intrinsicContentSize.width
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsets.zero
c.frame.size.height = titleView.frame.size.height - contentInset.top - contentInset.bottom
......
......@@ -1022,7 +1022,7 @@ public class NavigationDrawerController: RootController, UIGestureRecognizerDele
isStatusBarHidden = false
DispatchQueue.main.async { [weak self] in
if let s = self {
if let v = UIApplication.shared().keyWindow {
if let v = UIApplication.shared.keyWindow {
v.windowLevel = UIWindowLevelNormal
s.delegate?.navigationDrawerStatusBarHiddenState?(navigationDrawerController: s, hidden: false)
}
......@@ -1038,7 +1038,7 @@ public class NavigationDrawerController: RootController, UIGestureRecognizerDele
isStatusBarHidden = true
DispatchQueue.main.async { [weak self] in
if let s = self {
if let v = UIApplication.shared().keyWindow {
if let v = UIApplication.shared.keyWindow {
v.windowLevel = UIWindowLevelStatusBar + 1
s.delegate?.navigationDrawerStatusBarHiddenState?(navigationDrawerController: s, hidden: true)
}
......
......@@ -188,7 +188,7 @@ public class PhotoLibrary: NSObject {
- Parameter completion: An optional completion block.
*/
public func fetch(type: PHAssetCollectionType, subtype: PHAssetCollectionSubtype, completion: ([PhotoLibraryDataSource]) -> Void) {
DispatchQueue.global(attributes: DispatchQueue.GlobalAttributes.qosDefault).async { [weak self, type = type, subtype = subtype, completion = completion] in
DispatchQueue.global(qos: .default).async { [weak self, type = type, subtype = subtype, completion = completion] in
guard let s = self else {
return
}
......@@ -211,7 +211,7 @@ public class PhotoLibrary: NSObject {
}
let options = PHFetchOptions()
let descriptor = SortDescriptor(key: "creationDate", ascending: false)
let descriptor = NSSortDescriptor(key: "creationDate", ascending: false)
options.sortDescriptors = [descriptor]
options.includeHiddenAssets = true
options.includeAllBurstAssets = true
......@@ -263,7 +263,7 @@ public class PhotoLibrary: NSObject {
- Parameter completion: A completion block that is executed once the
transaction has been completed.
*/
public func performChanges(_ block: () -> Void, completion: ((Bool, NSError?) -> Void)? = nil) {
public func performChanges(_ block: () -> Void, completion: ((Bool, Error?) -> Void)? = nil) {
PHPhotoLibrary.shared().performChanges(block, completionHandler: completion)
}
......
......@@ -71,7 +71,7 @@ public class SearchBar: BarView {
@IBInspectable public var placeholder: String? {
didSet {
if let v: String = placeholder {
textField.attributedPlaceholder = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
}
}
}
......@@ -80,7 +80,7 @@ public class SearchBar: BarView {
@IBInspectable public var placeholderColor: UIColor = Color.darkText.others {
didSet {
if let v: String = placeholder {
textField.attributedPlaceholder = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
}
}
}
......
......@@ -64,7 +64,7 @@ public class SearchBarController: RootController {
let h: CGFloat = Device.height
let w: CGFloat = Device.width
let p: CGFloat = v.intrinsicContentSize().height + v.grid.layoutInset.top + v.grid.layoutInset.bottom
let p: CGFloat = v.intrinsicContentSize.height + v.grid.layoutInset.top + v.grid.layoutInset.bottom
v.width = w + v.grid.layoutInset.left + v.grid.layoutInset.right
v.height = p
......
......@@ -244,6 +244,17 @@ public class Switch: UIControl {
layoutSwitch()
}
}
public override var intrinsicContentSize: CGSize {
switch switchSize {
case .small:
return CGSize(width: 30, height: 25)
case .medium:
return CGSize(width: 40, height: 30)
case .large:
return CGSize(width: 50, height: 40)
}
}
/**
An initializer that initializes the object with a NSCoder object.
......@@ -300,17 +311,6 @@ public class Switch: UIControl {
styleForState(state: internalSwitchState)
}
public override func intrinsicContentSize() -> CGSize {
switch switchSize {
case .small:
return CGSize(width: 30, height: 25)
case .medium:
return CGSize(width: 40, height: 30)
case .large:
return CGSize(width: 50, height: 40)
}
}
/**
Toggle the Switch state, if On will be Off, and if Off will be On.
- Parameter completion: An Optional completion block.
......
......@@ -62,7 +62,7 @@ public protocol TextDelegate {
publishing or resolving.
*/
@objc
optional func textDidProcessEdit(text: Text, textStorage: TextStorage, string: String, result: TextCheckingResult?, flags: RegularExpression.MatchingFlags, stop: UnsafeMutablePointer<ObjCBool>)
optional func textDidProcessEdit(text: Text, textStorage: TextStorage, string: String, result: NSTextCheckingResult?, flags: NSRegularExpression.MatchingFlags, stop: UnsafeMutablePointer<ObjCBool>)
}
@objc(Text)
......@@ -113,7 +113,7 @@ public class Text : NSObject {
/// Prepares the TextStorage regular expression for matching.
private func prepareTextStorageExpression() {
textStorage.expression = try? RegularExpression(pattern: pattern, options: [])
textStorage.expression = try? NSRegularExpression(pattern: pattern, options: [])
}
/// Prepares the pre and post processing callbacks.
......@@ -123,7 +123,7 @@ public class Text : NSObject {
s.delegate?.textWillProcessEdit?(text: s, textStorage: textStorage, string: string, range: range)
}
}
textStorage.textDidProcessEdit = { [weak self] (textStorage: TextStorage, result: TextCheckingResult?, flags: RegularExpression.MatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
textStorage.textDidProcessEdit = { [weak self] (textStorage: TextStorage, result: NSTextCheckingResult?, flags: NSRegularExpression.MatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
if let s: Text = self {
s.delegate?.textDidProcessEdit?(text: s, textStorage: textStorage, string: textStorage.string, result: result, flags: flags, stop: stop)
}
......
......@@ -34,7 +34,12 @@ public protocol TextFieldDelegate: UITextFieldDelegate {}
@IBDesignable
public class TextField: UITextField {
/// A Boolean that indicates if the TextField is in an animating state.
/// Default size when using AutoLayout.
public override var intrinsicContentSize: CGSize {
return CGSize(width: width, height: 32)
}
/// A Boolean that indicates if the TextField is in an animating state.
public private(set) var animating: Bool = false
/// A property that accesses the backing layer's backgroundColor.
......@@ -83,7 +88,7 @@ public class TextField: UITextField {
/// TextField's text property observer.
@IBInspectable public override var text: String? {
didSet {
if true == text?.isEmpty && !isFirstResponder() {
if true == text?.isEmpty && !isFirstResponder {
placeholderEditingDidEndAnimation()
}
}
......@@ -97,7 +102,7 @@ public class TextField: UITextField {
set(value) {
placeholderLabel.text = value
if let v: String = value {
placeholderLabel.attributedText = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
placeholderLabel.attributedText = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
}
}
}
......@@ -110,7 +115,7 @@ public class TextField: UITextField {
didSet {
if !isEditing {
if let v: String = placeholder {
placeholderLabel.attributedText = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
placeholderLabel.attributedText = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
}
}
}
......@@ -121,7 +126,7 @@ public class TextField: UITextField {
didSet {
if isEditing {
if let v: String = placeholder {
placeholderLabel.attributedText = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderActiveColor])
placeholderLabel.attributedText = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderActiveColor])
}
}
tintColor = placeholderActiveColor
......@@ -143,7 +148,7 @@ public class TextField: UITextField {
set(value) {
detailLabel.text = value
if let v: String = value {
detailLabel.attributedText = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: detailColor])
detailLabel.attributedText = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: detailColor])
}
layoutDetailLabel()
}
......@@ -153,7 +158,7 @@ public class TextField: UITextField {
@IBInspectable public var detailColor: UIColor = Color.darkText.others {
didSet {
if let v: String = detailLabel.text {
detailLabel.attributedText = AttributedString(string: v, attributes: [NSForegroundColorAttributeName: detailColor])
detailLabel.attributedText = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: detailColor])
}
}
}
......@@ -298,11 +303,6 @@ public class TextField: UITextField {
}
}
/// Default size when using AutoLayout.
public override func intrinsicContentSize() -> CGSize {
return CGSize(width: width, height: 32)
}
/// Handles the text editing did begin state.
public func handleEditingDidBegin() {
dividerEditingDidBeginAnimation()
......@@ -507,6 +507,6 @@ public class TextField: UITextField {
/// Prepares the textAlignment.
private func prepareTextAlignment() {
textAlignment = .rightToLeft == UIApplication.shared().userInterfaceLayoutDirection ? .right : .left
textAlignment = .rightToLeft == UIApplication.shared.userInterfaceLayoutDirection ? .right : .left
}
}
......@@ -31,7 +31,7 @@
import UIKit
internal typealias TextWillProcessEdit = (TextStorage, String, NSRange) -> Void
internal typealias TextDidProcessEdit = (TextStorage, TextCheckingResult?, RegularExpression.MatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void
internal typealias TextDidProcessEdit = (TextStorage, NSTextCheckingResult?, NSRegularExpression.MatchingFlags, UnsafeMutablePointer<ObjCBool>) -> Void
public class TextStorage: NSTextStorage {
/// A callback that is executed when a process edit will happen.
......@@ -44,7 +44,7 @@ public class TextStorage: NSTextStorage {
public lazy var store: NSMutableAttributedString = NSMutableAttributedString()
/// The regular expression to match text fragments against.
public var expression: RegularExpression?
public var expression: NSRegularExpression?
/// Initializer.
public required init?(coder aDecoder: NSCoder) {
......@@ -67,7 +67,7 @@ public class TextStorage: NSTextStorage {
textWillProcessEdit?(self, string, range)
expression!.enumerateMatches(in: string, options: [], range: range) { (result: TextCheckingResult?, flags: RegularExpression.MatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
expression!.enumerateMatches(in: string, options: [], range: range) { (result: NSTextCheckingResult?, flags: NSRegularExpression.MatchingFlags, stop: UnsafeMutablePointer<ObjCBool>) -> Void in
self.textDidProcessEdit?(self, result, flags, stop)
}
super.processEditing()
......
......@@ -85,7 +85,7 @@ public class TextView: UITextView {
}
/// An override to the attributedText property.
public override var attributedText: AttributedString! {
public override var attributedText: NSAttributedString! {
didSet {
handleTextViewTextDidChange()
}
......
......@@ -167,7 +167,7 @@ public class ToolbarController: RootController {
let h: CGFloat = Device.height
let w: CGFloat = Device.width
let p: CGFloat = v.intrinsicContentSize().height + v.grid.layoutInset.top + v.grid.layoutInset.bottom
let p: CGFloat = v.intrinsicContentSize.height + v.grid.layoutInset.top + v.grid.layoutInset.bottom
v.width = w + v.grid.layoutInset.left + v.grid.layoutInset.right
v.height = p
......
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