-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict Concurrency #109
base: master
Are you sure you want to change the base?
Strict Concurrency #109
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Pod::Spec.new do |s| | ||
s.name = 'TinyConstraints' | ||
s.version = '4.0.2' | ||
s.version = '5.0.0' | ||
s.swift_versions = [5.0] | ||
s.summary = 'TinyConstraints is the syntactic sugar that makes Auto Layout sweeter for human use.' | ||
s.description = <<-DESC | ||
|
@@ -11,8 +11,8 @@ TinyConstraints is the syntactic sugar library that makes Auto Layout sweeter fo | |
s.author = { 'Robert-Hein Hooijmans' => '[email protected]' } | ||
s.source = { :git => 'https://github.com/roberthein/TinyConstraints.git', :tag => s.version.to_s } | ||
s.social_media_url = 'https://twitter.com/roberthein' | ||
s.ios.deployment_target = '9.0' | ||
s.tvos.deployment_target = '9.0' | ||
s.osx.deployment_target = '10.11' | ||
s.ios.deployment_target = '15.0' | ||
s.tvos.deployment_target = '15.0' | ||
s.osx.deployment_target = '10.15' | ||
s.source_files = 'TinyConstraints/Classes/**/*.{swift}' | ||
end |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -27,7 +27,7 @@ | |||||||
import UIKit | ||||||||
#endif | ||||||||
|
||||||||
extension TinyView: Constrainable { | ||||||||
@MainActor extension TinyView: Constrainable { | ||||||||
|
||||||||
@discardableResult | ||||||||
public func prepareForLayout() -> Self { | ||||||||
|
@@ -36,12 +36,12 @@ extension TinyView: Constrainable { | |||||||
} | ||||||||
} | ||||||||
|
||||||||
extension LayoutGuide: Constrainable { | ||||||||
@MainActor extension LayoutGuide: Constrainable { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed as the compiler infers
Suggested change
|
||||||||
@discardableResult | ||||||||
public func prepareForLayout() -> Self { return self } | ||||||||
} | ||||||||
|
||||||||
public protocol Constrainable { | ||||||||
@MainActor public protocol Constrainable { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strongly recommend the following instead:
Suggested change
This makes it so that existing code that doesn't yet have strict concurrency enabled can use this library version without having to make changes to their code. |
||||||||
var topAnchor: NSLayoutYAxisAnchor { get } | ||||||||
var bottomAnchor: NSLayoutYAxisAnchor { get } | ||||||||
var leftAnchor: NSLayoutXAxisAnchor { get } | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -31,13 +31,13 @@ | |||||||
public typealias Constraint = NSLayoutConstraint | ||||||||
public typealias Constraints = [Constraint] | ||||||||
|
||||||||
public enum ConstraintRelation: Int { | ||||||||
public enum ConstraintRelation: Int, Sendable { | ||||||||
case equal = 0 | ||||||||
case equalOrLess = -1 | ||||||||
case equalOrGreater = 1 | ||||||||
} | ||||||||
|
||||||||
public extension Collection where Iterator.Element == Constraint { | ||||||||
@MainActor public extension Collection where Iterator.Element == Constraint { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strongly recommend the following instead:
Suggested change
This makes it so that existing code that doesn't yet have strict concurrency enabled can use this library version without having to make changes to their code. |
||||||||
|
||||||||
func activate() { | ||||||||
|
||||||||
|
@@ -55,7 +55,7 @@ public extension Collection where Iterator.Element == Constraint { | |||||||
} | ||||||||
|
||||||||
#if os(OSX) | ||||||||
public extension Constraint { | ||||||||
@MainActor public extension Constraint { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||||
@objc | ||||||||
func with(_ p: Constraint.Priority) -> Self { | ||||||||
priority = p | ||||||||
|
@@ -68,7 +68,7 @@ public extension Constraint { | |||||||
} | ||||||||
} | ||||||||
#else | ||||||||
public extension Constraint { | ||||||||
@MainActor public extension Constraint { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||||
@objc | ||||||||
func with(_ p: LayoutPriority) -> Self { | ||||||||
priority = p | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,7 +28,7 @@ | |||||
import UIKit | ||||||
#endif | ||||||
|
||||||
public extension TinyView { | ||||||
@MainActor public extension TinyView { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||
|
||||||
@discardableResult | ||||||
func stack(_ views: [TinyView], axis: ConstraintAxis = .vertical, width: CGFloat? = nil, height: CGFloat? = nil, spacing: CGFloat = 0) -> Constraints { | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,7 +25,7 @@ | |||||
#if os(OSX) | ||||||
import AppKit | ||||||
|
||||||
public extension TinyView { | ||||||
@MainActor public extension TinyView { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||
|
||||||
@discardableResult | ||||||
func edgesToSuperview(excluding excludedEdge: LayoutEdge = .none, insets: TinyEdgeInsets = .zero, usingSafeArea: Bool = false) -> Constraints { | ||||||
|
@@ -53,7 +53,7 @@ | |||||
#else | ||||||
import UIKit | ||||||
|
||||||
public extension TinyView { | ||||||
@MainActor public extension TinyView { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||
|
||||||
@available(tvOS 10.0, *) | ||||||
@available(iOS 10.0, *) | ||||||
|
@@ -150,7 +150,7 @@ | |||||
} | ||||||
#endif | ||||||
|
||||||
public struct LayoutEdge: OptionSet { | ||||||
public struct LayoutEdge: OptionSet, Sendable { | ||||||
public let rawValue: UInt8 | ||||||
public init(rawValue: UInt8) { | ||||||
self.rawValue = rawValue | ||||||
|
@@ -164,7 +164,7 @@ public struct LayoutEdge: OptionSet { | |||||
public static let none = LayoutEdge(rawValue: 1 << 6) | ||||||
} | ||||||
|
||||||
public extension TinyView { | ||||||
@MainActor public extension TinyView { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||
|
||||||
private func safeConstrainable(for superview: TinyView?, usingSafeArea: Bool) -> Constrainable { | ||||||
guard let superview = superview else { | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,7 +28,7 @@ | |||||
import UIKit | ||||||
#endif | ||||||
|
||||||
public extension Constrainable { | ||||||
@MainActor public extension Constrainable { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||
|
||||||
@discardableResult | ||||||
func center(in view: Constrainable, offset: CGPoint = .zero, priority: LayoutPriority = .required, isActive: Bool = true) -> Constraints { | ||||||
|
@@ -339,7 +339,7 @@ public extension Constrainable { | |||||
} | ||||||
} | ||||||
|
||||||
public extension TinyView { | ||||||
@MainActor public extension TinyView { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed since
Suggested change
|
||||||
|
||||||
func setHugging(_ priority: LayoutPriority, for axis: ConstraintAxis) { | ||||||
setContentHuggingPriority(priority, for: axis) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ | |
import UIKit | ||
#endif | ||
|
||
extension TinyEdgeInsets { | ||
@MainActor extension TinyEdgeInsets { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's probably not recommended to add this since |
||
|
||
public static func uniform(_ value: CGFloat) -> TinyEdgeInsets { | ||
return TinyEdgeInsets(top: value, left: value, bottom: value, right: value) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed as the compiler infers
@MainActor
isolation for all members declared on this extension sinceConstrainable
is isolated to the@MainActor
.