NSAttributedString/NSMutableAttributedString missing substring constructors
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Currently, `NSString` APIs allow only to pass a managed string.
This forces APIs which would typically just use a substring be forced to allocate a string for the substring itself.
```
var myString = "asdf";
var myNSString = new NSAttributedString (myString.Subtring (0, 2));
```
Proposed APIs:
```
public NSAttributedString (string str, int start, int length) {}
public NSMutableAttributedString (string str, int start, int length) {}
... and a ton of over overloads
```
The implementation would then just marshal part of the string, avoiding an intermediate string allocation.
Via https://github.com/xamarin/xamarin-macios/pull/5517, a new `CreateNative (string, start, offset)` overload is introduced to allow creating a native string from a managed string slice.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.