RxSwift: Xcode 11.4 beta: 'NSTextView' is incompatible with 'weak' references

Short description of the issue:

When building using the just released Xcode 11.4 beta, RxCocoa fails to build on the following line: https://github.com/ReactiveX/RxSwift/blob/c3c0cac3d4c176b04404e3574d62b51776277384/RxCocoa/macOS/NSTextView%2BRx.swift#L20

Expected outcome:

RxCocoa compiles without errors or warnings.

What actually happens:

The compile fails with the following error:

RxSwift/RxCocoa/macOS/NSTextView+Rx.swift:20:12: 'NSTextView' is incompatible with 'weak' references

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

Version 5.0.1

Platform/Environment

  • iOS
  • macOS
  • tvOS
  • watchOS
  • playgrounds

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

  • easy, 100% repro
  • sometimes, 10%-100%
  • hard, 2% - 10%
  • extremely hard, %0 - 2%

Xcode version:

  Version 11.4 beta (11N111s)

Installation method:

  • CocoaPods
  • Carthage
  • Git submodules

I have multiple versions of Xcode installed: (so we can know if this is a potential cause of your issue)

  • yes (11.3.1, 11.4 beta 1)
  • no

Level of RxSwift knowledge: (this is so we can understand your level of knowledge and formulate the response in an appropriate manner)

  • just starting
  • I have a small code base
  • I have a significant code base

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 26 (21 by maintainers)

Commits related to this issue

Most upvoted comments

Yup, this works. I’m cutting a patch release: image

OK, I’ve filed this as FB7566796.

I guess let’s wait to see what the AppKit/Xcode team have to say about this - my guess is that this error was meant to be turned on a while back (or is considered an improvement to diagnostics & warnings), and we may be stuck with it.

Here’s the relevant code from NSTextView.h:

#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE
#endif

// ... 

/**************************** Ownership policy ****************************/
// Returns whether instances of the class operate in the object ownership policy introduced with macOS Sierra and later. When YES, the new object owner policy is used. Under the policy, each text view strongly retains its text storage and its text container weakly references the view. Also, the text views are compatible with __weak storage. The default is YES.
@property (readonly, class) BOOL stronglyReferencesTextStorage API_AVAILABLE(macos(10.12));

I understand your reluctance to bump deployment targets for a bug that might be transitory, but I don’t think raising the deployment target is a bad thing for a major release. Consider the impact on yourself and the other developers of this project in supporting code that needs to compile and run on an operating system you no longer have access to. I believe you can’t even run CI anywhere for Yosemite?

Hey, you’re right! This is odd, was sure I pushed all of them. Taking care of the rest RN.

I don’t think raising the deployment target is a bad thing for a major release

I have no issue with bumping the versions, but I’m not a macOS developer myself, so bumping a version of a platform I don’t have intimate knowledge with seems a bit careless from my part.

Regardless, let’s wait for Apple and if we don’t get appropriate feedback, we might decide to bump.

Thanks for the research and time you’ve put into this @tonyarnold !