Hi David,
Are padding or spacing computed properties that access either rectangle? They
aren't defined in your stripped down code. For example:
var spacing: CGFloat {
return imageRect.maxX
}
Without doing something like that, I don't see the same access conflicts that
you're seeing.
-Kyle
> On Jul 27, 2017, at 5:04 AM, David Hart via swift-users
> <[email protected]> wrote:
>
> 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 <http://bugs.swift.org/> or if I’m missing something?
>
> David.
> _______________________________________________
> swift-users mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users