Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/xcode16' into dev/rolf/xcode16-b…
Browse files Browse the repository at this point in the history
…123456-xkit
  • Loading branch information
rolfbjarne committed Sep 6, 2024
2 parents d502b18 + 92cd45d commit bec6de8
Show file tree
Hide file tree
Showing 184 changed files with 4,696 additions and 5,611 deletions.
17 changes: 17 additions & 0 deletions src/Accessibility/AXPrefers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,22 @@ public static bool HorizontalTextEnabled ()
return AXPrefersHorizontalTextLayout () != 0;
}

#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
[DllImport (Constants.AccessibilityLibrary)]
static extern byte AXPrefersNonBlinkingTextInsertionIndicator ();

[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
public static bool NonBlinkingTextInsertionIndicator ()
{
return AXPrefersNonBlinkingTextInsertionIndicator () != 0;
}
#endif // NET
}
}
76 changes: 76 additions & 0 deletions src/Accessibility/AXSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#nullable enable

using System;
using System.Runtime.InteropServices;

using CoreGraphics;
using Foundation;
using ObjCRuntime;

#if NET

namespace Accessibility {

[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
[Native]
public enum AXSettingsFeature : long {
/// <summary>Jump to the "Allow Apps to Request to Use" setting in Personal Voice.</summary>
PersonalVoiceAllowAppsToRequestToUse = 1,
}

public static class AXSettings {
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
[DllImport (Constants.AccessibilityLibrary)]
static extern byte AXAssistiveAccessEnabled ();

/// <summary>Returns whether Assistive Access is running.</summary>
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
public static bool IsAssistiveAccessEnabled {
get {
return AXAssistiveAccessEnabled () != 0;
}
}

[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
[DllImport (Constants.AccessibilityLibrary)]
unsafe static extern void AXOpenSettingsFeature (nint /* AXSettingsFeature */ feature, BlockLiteral *block);

/// <summary>Open the Settings app to the specified section.</summary>
/// <param name="feature">The section to open.</param>
/// <param name="completionHandler">This callback is called when the section has been opened. The <see cref="Foundation.NSError" /> argument will be null if successful.</param>
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("tvos18.0")]
public unsafe static void OpenSettingsFeature (AXSettingsFeature feature, Action<NSError?> completionHandler)
{
delegate* unmanaged<IntPtr, IntPtr, void> trampoline = &OpenSettingsFeatureCompletionHandler;
using var block = new BlockLiteral (trampoline, completionHandler, typeof (AXSettings), nameof (OpenSettingsFeatureCompletionHandler));
AXOpenSettingsFeature ((nint) (long) feature, &block);
}

[UnmanagedCallersOnly]
static void OpenSettingsFeatureCompletionHandler (IntPtr block, IntPtr error)
{
var del = BlockLiteral.GetTarget<Action<NSError?>> (block);
if (del is not null) {
var errorObject = Runtime.GetNSObject<NSError> (error);
del (errorObject);
}
}
}
}

#endif // NET
24 changes: 22 additions & 2 deletions src/CarPlay/CPCompat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#nullable enable

using System;
using CoreGraphics;
using Foundation;
using ObjCRuntime;
using System.ComponentModel;
Expand All @@ -18,8 +19,8 @@
using NativeHandle = System.IntPtr;
#endif

#if !NET
namespace CarPlay {
#if !NET
[Register (SkipRegistration = true)]
[Unavailable (PlatformName.iOS, PlatformArchitecture.All)]
[Obsolete ("This API has been removed from the native SDK.")]
Expand All @@ -38,5 +39,24 @@ public class CPEntity : NSObject, INSSecureCoding {

public override NativeHandle ClassHandle => throw new NotSupportedException ();
}
}
#endif
#if !XAMCORE_5_0 && __IOS__
public partial class CPListItem {
#if NET
[ObsoletedOSPlatform ("ios14.0", "Do not use; this API was removed.")]
[UnsupportedOSPlatform ("tvos")]
[UnsupportedOSPlatform ("macos")]
[UnsupportedOSPlatform ("maccatalyst")]
[SupportedOSPlatform ("ios12.0")]
#else
[Deprecated (PlatformName.iOS, 14, 0, message: "Do not use; this API was removed.")]
#endif
[EditorBrowsable (EditorBrowsableState.Never)]
public static CGSize MaximumListItemImageSize {
get {
return default (CGSize);
}
}
}
#endif // !XAMCORE_5_0 && __IOS__
}
23 changes: 23 additions & 0 deletions src/CoreData/NSPersistentStoreCoordinator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#if NET
using System;
using System.Runtime.Versioning;
using System.Runtime.InteropServices;

using ObjCRuntime;

namespace CoreData {
public partial class NSPersistentStoreCoordinator {
#if !__TVOS__
[SupportedOSPlatform ("macos15.0")]
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[UnsupportedOSPlatform ("tvos")]
public NSManagedObjectID GetManagedObjectId (string value)
{
using var str = new TransientString (value);
return GetManagedObjectId ((IntPtr) str, (nuint) value.Length);
}
#endif // !__TVOS__
}
}
#endif
9 changes: 9 additions & 0 deletions src/CoreSpotlight/CSEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum CSIndexErrorCode : long {
RemoteConnectionError = -1003,
QuotaExceeded = -1004,
IndexingUnsupported = -1005,
MismatchedClientState = -1006,
}

/// <summary>Enumerates errors that can occur while running a Core Spotlight query with <see cref="M:CoreSpotlight.CSSearchQuery.Start" />.</summary>
Expand All @@ -53,4 +54,12 @@ public enum CSFileProtection {
CompleteUnlessOpen,
CompleteUntilFirstUserAuthentication,
}

[NoTV, Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Native]
public enum CSUserInteraction : long {
Select,
Default = Select,
Focus,
}
}
14 changes: 7 additions & 7 deletions src/DeviceDiscoveryExtension/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace DeviceDiscoveryExtension {

[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (16, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[Native]
public enum DDDeviceProtocol : long {
Invalid = 0,
Dial = 1,
}

[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (16, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[Native]
public enum DDDeviceCategory : long {
HiFiSpeaker = 0,
Expand All @@ -35,7 +35,7 @@ public enum DDDeviceCategory : long {
AccessorySetup = 6,
}

[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (16, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[Native]
public enum DDDeviceState : long {
Invalid = 0,
Expand All @@ -45,15 +45,15 @@ public enum DDDeviceState : long {
Invalidating = 30,
}

[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (16, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[Native]
public enum DDDeviceMediaPlaybackState : long {
NoContent = 0,
Paused = 1,
Playing = 2,
}

[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (16, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[ErrorDomain ("DDErrorDomain")]
[Native]
public enum DDErrorCode : long {
Expand All @@ -68,7 +68,7 @@ public enum DDErrorCode : long {
// Next, // don't bind 'Next', it's not static and we'd have to break compat if it were ever to change
}

[NoMac, iOS (16, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (16, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[Native]
public enum DDEventType : long {
Unknown = 0,
Expand All @@ -77,7 +77,7 @@ public enum DDEventType : long {
DeviceChanged = 42,
}

[NoMac, iOS (18, 0), NoMacCatalyst, NoWatch, NoTV]
[Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0), NoWatch, NoTV]
[Native]
[Flags]
public enum DDDeviceSupports : ulong {
Expand Down
1 change: 1 addition & 0 deletions src/Foundation/NSObject.mac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public partial class NSObject {
static IntPtr sm = Dlfcn.dlopen (Constants.ServiceManagementLibrary, 1);
static IntPtr sa = Dlfcn.dlopen (Constants.SafetyKitLibrary, 1);
static IntPtr cr = Dlfcn.dlopen (Constants.CryptoTokenKitLibrary, 1);
static IntPtr dd = Dlfcn.dlopen (Constants.DeviceDiscoveryExtensionLibrary, 1);
static IntPtr fk = Dlfcn.dlopen (Constants.FSKitLibrary, 1);

#if !NET
Expand Down
15 changes: 15 additions & 0 deletions src/HealthKit/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ public enum HKCategoryValueCervicalMucusQuality : long {
[Mac (13, 0)]
[MacCatalyst (13, 1)]
[Native]
[Deprecated (PlatformName.iOS, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.MacCatalyst, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.TvOS, 18, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.WatchOS, 11, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
[Deprecated (PlatformName.MacOSX, 15, 0, message: "Use 'HKCategoryValueVaginalBleeding' instead.")]
public enum HKCategoryValueMenstrualFlow : long {
NotApplicable = 0,
Unspecified = 1,
Expand All @@ -381,6 +386,16 @@ public enum HKCategoryValueMenstrualFlow : long {
None,
}

[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Native]
public enum HKCategoryValueVaginalBleeding : long {
Unspecified = 1,
Light = 2,
Medium = 3,
Heavy = 4,
None = 5,
}

/// <summary>Enumerates the results of an ovulation test.</summary>
[Mac (13, 0)]
[MacCatalyst (13, 1)]
Expand Down
34 changes: 34 additions & 0 deletions src/HealthKit/HKSupportFunctions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#nullable enable

using System;
using System.Runtime.InteropServices;

using Foundation;
using ObjCRuntime;

namespace HealthKit {
/// <summary>This class contains helper functions for the <see cref="HKStateOfMindValenceClassification" /> enum.</summary>
#if NET
[SupportedOSPlatform ("ios18.0")]
[SupportedOSPlatform ("maccatalyst18.0")]
[SupportedOSPlatform ("macos15.0")]
[UnsupportedOSPlatform ("tvos")]
#else
[Watch (11, 0), NoTV, Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
#endif
public static class HKStateOfMindValence {
[DllImport (Constants.HealthKitLibrary)]
static extern IntPtr HKStateOfMindValenceClassificationForValence (double valence);

/// <summary>Gets the valence classification appropriate for a given valence value.</summary>
/// <param name="valence">The valence value whose classification to get.</param>
/// <returns>The valence classification, or null if the specified valence is outside of the supported range of valence values.</returns>
public static HKStateOfMindValenceClassification? GetClassification (double valence)
{
var nsnumber = Runtime.GetNSObject<NSNumber> (HKStateOfMindValenceClassificationForValence (valence), owns: false);
if (nsnumber is null)
return null;
return (HKStateOfMindValenceClassification) (long) nsnumber.LongValue;
}
}
}
42 changes: 42 additions & 0 deletions src/MapKit/MKAddressFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#if !WATCH

using System;
using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
using MapKit;

#nullable enable

namespace MapKit {
/// <summary>This enum is used to select how to initialize a new instance of a <see cref="MKAddressFilter" />.</summary>
public enum MKAddressFilterConstructorOption {
/// <summary>The <c>options</c> parameter passed to the constructor are inclusive.</summary>
Include,
/// <summary>The <c>options</c> parameter passed to the constructor are exclusive.</summary>
Exclude,
}

public partial class MKAddressFilter {
/// <summary>Create a new <see cref="MKAddressFilter" /> with the specified address filter options.</summary>
/// <param name="options">The address filter options to use.</param>
/// <param name="constructorOption">Specify whether the <paramref name="options" /> argument is including or excluding the given options.</param>
/// <returns>A new <see cref="MKAddressFilter" /> instance with the specified address filter options.</returns>
public MKAddressFilter (MKAddressFilterOption options, MKAddressFilterConstructorOption constructorOption)
: base (NSObjectFlag.Empty)
{
switch (constructorOption) {
case MKAddressFilterConstructorOption.Include:
InitializeHandle (_InitIncludingOptions (options));
break;
case MKAddressFilterConstructorOption.Exclude:
InitializeHandle (_InitExcludingOptions (options));
break;
default:
throw new ArgumentOutOfRangeException (nameof (constructorOption), constructorOption, "Invalid enum value.");
}
}
}
}

#endif
Loading

0 comments on commit bec6de8

Please sign in to comment.