Robert Payne 9 жил өмнө
parent
commit
79137bce68

+ 7 - 7
Source/ConstraintMaker.swift

@@ -152,9 +152,9 @@ public class ConstraintMaker {
         return ConstraintMakerExtendable(description)
     }
     
-    internal static func prepareConstraints(view: ConstraintView, closure: @noescape(make: ConstraintMaker) -> Void) -> [Constraint] {
+    internal static func prepareConstraints(view: ConstraintView, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
         let maker = ConstraintMaker(view: view)
-        closure(make: maker)
+        closure(maker)
         let constraints = maker.descriptions
             .map { $0.constraint }
             .filter { $0 != nil }
@@ -162,9 +162,9 @@ public class ConstraintMaker {
         return constraints
     }
     
-    internal static func makeConstraints(view: ConstraintView, closure: @noescape(make: ConstraintMaker) -> Void) {
+    internal static func makeConstraints(view: ConstraintView, closure: (_ make: ConstraintMaker) -> Void) {
         let maker = ConstraintMaker(view: view)
-        closure(make: maker)
+        closure(maker)
         let constraints = maker.descriptions
             .map { $0.constraint }
             .filter { $0 != nil }
@@ -174,14 +174,14 @@ public class ConstraintMaker {
         }
     }
     
-    internal static func remakeConstraints(view: ConstraintView, closure: @noescape(make: ConstraintMaker) -> Void) {
+    internal static func remakeConstraints(view: ConstraintView, closure: (_ make: ConstraintMaker) -> Void) {
         self.removeConstraints(view: view)
         self.makeConstraints(view: view, closure: closure)
     }
     
-    internal static func updateConstraints(view: ConstraintView, closure: @noescape(make: ConstraintMaker) -> Void) {
+    internal static func updateConstraints(view: ConstraintView, closure: (_ make: ConstraintMaker) -> Void) {
         let maker = ConstraintMaker(view: view)
-        closure(make: maker)
+        closure(maker)
         let constraints = maker.descriptions
             .map { $0.constraint }
             .filter { $0 != nil }

+ 4 - 4
Source/ConstraintView+Extensions.swift

@@ -121,22 +121,22 @@ public extension ConstraintView {
     public var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
     
     @available(*, deprecated:0.40.0, message:"Use newer snp.* syntax.")
-    public func snp_prepareConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) -> [Constraint] {
+    public func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
         return self.snp.prepareConstraints(closure)
     }
     
     @available(*, deprecated:0.40.0, message:"Use newer snp.* syntax.")
-    public func snp_makeConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
+    public func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
         self.snp.makeConstraints(closure)
     }
     
     @available(*, deprecated:0.40.0, message:"Use newer snp.* syntax.")
-    public func snp_remakeConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
+    public func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
         self.snp.remakeConstraints(closure)
     }
     
     @available(*, deprecated:0.40.0, message:"Use newer snp.* syntax.")
-    public func snp_updateConstraints(_ closure: @noescape(make: ConstraintMaker) -> Void) {
+    public func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
         self.snp.updateConstraints(closure)
     }
     

+ 4 - 4
Source/ConstraintViewDSL.swift

@@ -148,19 +148,19 @@ public struct ConstraintViewDSL {
     }
     
     @discardableResult
-    public func prepareConstraints(_ closure: @noescape (make: ConstraintMaker) -> Void) -> [Constraint] {
+    public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
         return ConstraintMaker.prepareConstraints(view: self.view, closure: closure)
     }
     
-    public func makeConstraints(_ closure: @noescape (make: ConstraintMaker) -> Void) {
+    public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
         ConstraintMaker.makeConstraints(view: self.view, closure: closure)
     }
     
-    public func remakeConstraints(_ closure: @noescape (make: ConstraintMaker) -> Void) {
+    public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
         ConstraintMaker.remakeConstraints(view: self.view, closure: closure)
     }
     
-    public func updateConstraints(_ closure: @noescape (make: ConstraintMaker) -> Void) {
+    public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
         ConstraintMaker.updateConstraints(view: self.view, closure: closure)
     }
     

+ 2 - 2
Source/Debugging.swift

@@ -138,10 +138,10 @@ private func conditionalOptional<T>(from object: T) -> Optional<T> {
 }
 
 private func descriptionForObject(_ object: AnyObject) -> String {
-    let pointerDescription = NSString(format: "%p", UInt(ObjectIdentifier(object)))
+    let pointerDescription = String(format: "%p", UInt(bitPattern: ObjectIdentifier(object)))
     var desc = ""
     
-    desc += object.dynamicType.description()
+    desc += type(of: object).description()
     
     if let object = object as? ConstraintView {
         desc += ":\(object.snp.label ?? pointerDescription)"