Le 12 févr. 2017 à 18:41, Karl Wagner a écrit :
>
> I've seen this before; I considered it something to be resolved in AppKit.
> Strings in Swift are values, and the framework expects it to be a reference.
> Since NSTextStorage is itself a reference-type and informs its
I've seen this before; I considered it something to be resolved in AppKit.
Strings in Swift are values, and the framework expects it to be a reference.
Since NSTextStorage is itself a reference-type and informs its delegate of
changes, those frameworks should probably retain the NSTS
Got some clarity on this from Apple folks on Twitter:
https://twitter.com/jtbandes/status/830159670559993856
On Fri, Feb 10, 2017 at 12:54 PM, Michel Fortin
wrote:
> I did file one (30314719). I might not have explained the problem clearly
> enough, I suppose, because
This seems like a bug (missing feature?) in how the API is imported for
Swift. You might consider filing a Radar.
On Thu, Feb 9, 2017 at 3:12 PM Michel Fortin via swift-users <
swift-users@swift.org> wrote:
> The `string` property of `NSTextStorage` is of type `String`, but the
> contract it
In case this is useful to someone, this is the workaround I'll be using:
```
class CustomTextStorage: NSTextStorage {
private let backingStore: NSMutableAttributedString
// This method should never get called from Objective-C as it doesn't
respect
// the API contract
The `string` property of `NSTextStorage` is of type `String`, but the contract
it must implement is that it should return the backing store of the attributed
string (the underlying `NSMutableString` used as the backing store). It seems
to me that this makes it impossible to implement correctly