Skip to content

Commit

Permalink
- remove unnecessary value
Browse files Browse the repository at this point in the history
- autolayout code moved to `setAutoLayout` function
  • Loading branch information
bielikb committed Sep 14, 2019
1 parent c2b82f1 commit f221d1e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Sources/UseAutoLayout/UseAutoLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ import UIKit

@propertyWrapper
public struct UseAutoLayout<T: UIView> {
var value: T

public var wrappedValue: T {
get { return value }
set { self.value.translatesAutoresizingMaskIntoConstraints = false }
didSet {
setAutoLayout()
}
}

public init(wrappedValue: T) {
value = wrappedValue
self.wrappedValue = wrappedValue
setAutoLayout()
}

func setAutoLayout() {
wrappedValue.translatesAutoresizingMaskIntoConstraints = false
}
}
#endif

0 comments on commit f221d1e

Please sign in to comment.