- Fixes#4698: CGAffineTransform.Scale does not work like Swift's .scaledBy(x:y:)
(https://github.com/xamarin/xamarin-macios/issues/4698)
- 'Scale' monotouch-test now covers the new overload for the new multiplication order.
- Changed the Scale test's values so we have different values for 'x0' (it was always 0 before) and so it matches the test case from the bug report.
* Same fix for Rotate and Translate
* [UIKit] UIGestureRecognizer, support a way of unsubscribing without creating cycles
This now tracks all the uses of AddTarget with delegates by recording
the Token/Selector pair and making `Dispose()` release all the linkage
as well as providing an enumerator that can be used to get all the
registered Action handlers - this can then be used with .First() and
then passed to `RemoveTarget`.
This addresses https://github.com/xamarin/xamarin-macios/issues/4190
This initial patch is here for discussion of the approach, want to
review and test this before we merge.
* Simplify code a little bit.
* Add test.
* [tests] Add an NSAutoreleasePool to make GestureRecognizerTest.NoStrongCycles happy on 32-bit.
Fix numerous issues with NSLayoutManager[Delegate]:
* The classes are available in both AppKit and UIKit, but the bindings are
duplicated (unsuccessfully) in both appkit.cs and uikit.cs. So create a new
xkit.cs that is shared between XI and XM, and put a shared version of the
bindings there.
* Bind everything that hasn't already been bound (or deprecated by Apple).
* Methods that take a nullable NSRangePointer has been bound with three overloads:
* A protected overridable (exported) method that uses IntPtr.
* A public method without the parameter.
* A public method with the parameter typed as 'ref NSRange'.
This makes sure the native method can be overridden if needed, while at
the same time making it possible to call without providing the nullable
parameter.
* Fix numerous ugly bindings:
* There's a great nint/nuint confusion for parameters referring to
'character index' and 'glyph index'. XI seems to prefer nuint, while XM
seems to prefer nint. Standardize on nuint, since that's how Apple
created them.
* Many methods have names than sound like Objective-C. Fix them all,
either right away when possible, or for XAMCORE_4_0.
* Several parameter names have been modified to comply with our naming
guidelines (no abbreviations).
Fixes https://github.com/xamarin/xamarin-macios/issues/4740.
The structs MTLQuadTessellationFactorsHalf and
MTLTriangleTessellationFactorsHalf are wrong as per the header
definition:
```c
typedef struct {
/* NOTE: edgeTessellationFactor and insideTessellationFactor are interpreted as half (16-bit floats) */
uint16_t edgeTessellationFactor[4];
uint16_t insideTessellationFactor[2];
} MTLQuadTessellationFactorsHalf;
typedef struct {
/* NOTE: edgeTessellationFactor and insideTessellationFactor are interpreted as half (16-bit floats) */
uint16_t edgeTessellationFactor[3];
uint16_t insideTessellationFactor;
} MTLTriangleTessellationFactorsHalf;
```
We set the arrays size to be the correct one.
Fixes https://github.com/xamarin/xamarin-macios/issues/4611
* Add tests that ensure that the size of the managed structs is the same
as the native ones.
The values used have been checked against a native app compiled on 32
and 64 (iphone 5 and iphone X).
* Avoid `ArgumentNullException` in default/empty `SecProtocolMetadata.PeerPublicKey`
* Add two `SecProtocolMetadata.CreateSecret` API - disabled as the current tests (incomplete?) crash in unit tests
* Add basic unit tests for `[Sec|NW]ProtocolMetadata`
* Update xtro
This means less (duplicated) manual code, which means less errors, which also
means we're now getting some new members that previously weren't duplicated
correctly.
Fixes https://github.com/xamarin/xamarin-macios/issues/4183.
* Move `NLTag` to static class (instead of enum) since it's not used in API, except along NSString. Fixes https://github.com/xamarin/xamarin-macios/issues/4774
* Add new member to `NLLanguage` to avoid `ArgumentNullException` when it has not been evaludated (API returns `null`), see unit tests;
* Add `[Params]` to `NLTagger` constructors so they are easier to use (no need to create the array in source);
* Fix `GetTag` so it returns (`out`) the `NSRange`, it's natively a `NSRangePointer`;
* Fix `GetTag[s]` API with changes to `NLTag` de-enumification;
* Add unit tests
- Fixes#4441: [generator] Binding with return value of Class [] do not do the right thing
(https://github.com/xamarin/xamarin-macios/issues/4441)
- Turns out the logic to put INativeObjects into NSArrays was already in place. We simply needed to add the missing (IntPtr handle, bool owns) overload to `Class`.
- Uncommented AppKit `registeredImageRepClasses` since it was using `Class []`. Tested locally and it works fine.
- Reimplemented `Foundation`'s `NSSecureUnarchiveFromDataTransformer` and its test which were also using `Class []`.
AVMediaTypeTimedMetadata has been obsoleted since iOS 6 but was totally
removed (returns null) in iOS 12.
Adjust test and provide a (better) deprecation warning for developers.
We have a test for CGFunction, and in iOS 12 the behavior changed where
previously the CGFunction was invoked immediately when rendering, it's now
retained and only called later.
This is troublesome for the test, because it disposes the managed CGFunction
when it thinks it's completed. Since the function is invoked way later, the
test now crashes. Ops.
The obvious fix is to change the test to dispose the CGFunction later. This
falls flat when finding out that "later" is undetermined. Native code retains
the CGFunction, and can do whatever it wishes with it until it's released, and
there's no way to know when that is.
OK: what about not disposing the CGFunction, and letting the GC do its job?
This also falls flat, because there's a circular reference between the native
CGFunction and the managed wrapper, preventing any of them from being released
automatically by the GC. The only way to break the circular reference is to
dispose the managed wrapper.
So, can we fix the circular reference? Unfortunately not, because we can't
monitor the native CGFunction's retain count, which is required in order to
switch the native->managed link between weak and strong according to the
retain count.
This leaves one solution (that I could come up with at least): make sure
everything works fine after disposing the managed wrapper.
This involves a few things:
* Only break the native->managed connection (the 'gch' GCHandle) when the
native CGFunction is freed. This is accomplished by using the API provided
by Apple for exactly that purpose (the 'release' callback field in the
'CGFunctionCallbacks' struct).
* Use a static variable for the 'CGFunctionCallback' struct and its contents.
This solves another potential problem: the GC could have collected the
delegate to the 'EvaluateCallback' function at any point.
* Don't null out the 'evaluate' delegate in Dispose. This leaves the user with
no way to break a potential circular reference through that delegate (since
it will never be null), so provide a property that makes it possible for
users to explicitly null out the delegate ('EvaluateFunction').
* Only call the 'evaluate' callback if it's not null.
This also has the additional advantage that test (and any customer code
running into the same issue) works without modifications.
Some of the tests fail because the assert is looking at the wrong iOS
version. Looking at the API definitions:
* UIStackView - Available in iOS 9, not iOS 8.
* AudioServicesPlayAlertSoundWithCompletion - Available in iOS 9, not
iOS 8.
All the other tests reported in the issue pass.
Issue: https://github.com/xamarin/xamarin-macios/issues/4437
* [CoreGraphics] Add CGPDFArray.Get* overloads that take a nint index, since the CGPDFArray.Count property returns nint.
This makes the following code work:
for (var i = 0; i < array.Count; i++)
array.GetInt (i, ...)
* Don't add [MonoPInvokeCallback] to Mac code.
* [CoreGraphics] Rename CGPDFArray.ApplyBlockCallback to ApplyCallback.
Since the fact that the method is implemented using a block is not relevant
for managed code.
This also makes the method named like an equivalent method in CGPDFDictionary.
* [CoreGraphics] Change CGPDFArray.Apply to take an 'object' as the info parameter instead of IntPtr.
This makes it nicer for managed code.
* [CoreGraphics] CGPDFArray.Apply: resolve the iterated object to the actual CGPDFObject type.
* [CoreGraphics] Add an CGPDFDictionary.Apply overload that resolves the iterated object to the actual CGPDFObject type.
This method was previously only available in Classic, so I just reintroduced
it with a few changes to make the API nicer (which isn't a breaking change
since we're not building Classic anymore).
* [tests] Add test for CGPDF types.
* [tests] Don't run the new tests unless the SDK was part of Xcode 10
* [CoreGraphics] Add first batch of Xcode10 APIs, added an enum that we did not surface before
* [xcode10] CoreGraphics support
* Fix whitespace/formatting and add comma after last enum value.
* Make CFPropertyList follow normal INativeObject creation pattern.
* Make CFPropertyList.AsData return the error as a tuple.
* Fix CFPropertyList.AsData to not leak.
* CFPropertyList.Value: use Runtime.GetNSObject so that we don't accidentally create duplicate wrappers for the same native object.
* [CoreGraphics] Update to beta 5.
* Update xtro definitions.
* Add tests.
* Don't compare value type with null.
* Use PascalCase for named return tuples.
* [CoreFoundation] Make CFPropertyList enums native and fix code accordingly.
* [tests] Fix fetching 64-bit int to actually fetch a 64-bit int and not a nint.
* [tests] Teach introspection's ApiCMAttachmentTest about CFPropertyList.
The default `Message` property is not every helpful. Better information
is available inside the `Error` property but it's not general (nor cross
platform) when dealing with exception.
Include unit tests (on an existing test checking NSError values)
https://github.com/xamarin/xamarin-macios/issues/4133
Unify the code to detect frameworks that aren't supported in the simulator (we
had switches in two places, now this data is stored per framework).
Also remove some of the Metal frameworks for some of the platforms from these
lists (since they're now available in the simulator in some cases), which
fixes#4422.
It also seems CoreAudioKit is now available in the simulator (it wasn't in the
first Xcode 7 beta, but apparently added in a later beta. This made our
exclusion incorrect, but we never noticed).
https://github.com/xamarin/xamarin-macios/issues/4422