Hello,
In Xcode 9 beta 4, Swift 4, I’m getting runtime errors popping up for
Simultaneous accesses and I think they may be false negatives. Here’s a
stripped down version of my code:
class MyButton: UIButton {
fileprivate var imageRect: CGRect = .zero
fileprivate var titleRect: CGRect = .zero
func updateRects() {
if imageBeforeTitle {
layoutHorizontally(leftRect: &imageRect, rightRect: &titleRect)
} else {
layoutHorizontally(leftRect: &titleRect, rightRect: &imageRect)
}
}
func layoutHorizontally(leftRect: inout CGRect, rightRect: inout
CGRect) {
leftRect.origin.x = padding
rightRect.origin.x = leftRect.maxX + spacing
}
}
While the layoutHorizontally method has two CGRect inout parameters, never in
my code do I pass the same CGRect. Any ideas if this is a bug I should post on
bugs.swift.org or if I’m missing something?
David.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users