Skip to content

Commit

Permalink
[Foundation] Implement Xcode 16.2 beta 1-3 changes. (#21711)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Dec 2, 2024
1 parent 6640405 commit 509a063
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 46 deletions.
35 changes: 12 additions & 23 deletions src/Foundation/NSBundle.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,32 @@
using System;
using System.ComponentModel;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;

using ObjCRuntime;

// Disable until we get around to enable + fix any issues.
#nullable disable
#nullable enable

namespace Foundation {
public partial class NSBundle : NSObject {

#if !NET
[Obsolete ("Use 'GetLocalizedString' instead.")]
public virtual string LocalizedString (string key, string value, string table)
public NSString GetLocalizedString (string key, string? value = null, string? table = null)
{
return (string) GetLocalizedString ((NSString) key, (NSString) value, (NSString) table);
return GetLocalizedString ((NSString) key, (NSString?) value, (NSString?) table);
}

[Obsolete ("Use 'GetLocalizedString' instead.")]
public string LocalizedString (string key, string comment)
{
return LocalizedString (key, "", "");
}

[Obsolete ("Use 'GetLocalizedString' instead.")]
public string LocalizedString (string key, string val, string table, string comment)
{
return LocalizedString (key, val, table);
}
#endif
public NSString GetLocalizedString (string key, string value = null, string table = null)
public string [] PathsForResources (string fileExtension)
{
return GetLocalizedString ((NSString) key, (NSString) value, (NSString) table);
return PathsForResources (fileExtension, null);
}

public string [] PathsForResources (string fileExtension)
#if !MONOMAC && !XAMCORE_5_0
[Obsolete ("Do not use this constructor, it does not work as expected.")]
[EditorBrowsable (EditorBrowsableState.Never)]
public NSBundle ()
: base (NSObjectFlag.Empty)
{
return PathsForResources (fileExtension, null);
}
#endif // !MONOMAC && !XAMCORE_5_0
}
}
21 changes: 14 additions & 7 deletions src/foundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,6 @@ interface NSCachedUrlResponse : NSCoding, NSSecureCoding, NSCopying {
}

[BaseType (typeof (NSObject))]
// 'init' returns NIL - `init` now marked as NS_UNAVAILABLE
[DisableDefaultCtor]
interface NSCalendar : NSSecureCoding, NSCopying {
[DesignatedInitializer]
Expand Down Expand Up @@ -5201,8 +5200,6 @@ interface NSLinguisticTag {
#endif

[BaseType (typeof (NSObject))]
// 'init' returns NIL so it's not usable evenif it does not throw an ObjC exception
// funnily it was "added" in iOS 7 and header files says "do not invoke; not a valid initializer for this class"
[DisableDefaultCtor]
interface NSLocale : NSSecureCoding, NSCopying {
[Static]
Expand Down Expand Up @@ -8752,6 +8749,10 @@ interface NSUrlRequest : NSSecureCoding, NSMutableCopying {
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("allowsPersistentDNS")]
bool AllowsPersistentDns { get; }

[TV (18, 2), iOS (18, 2), MacCatalyst (18, 2), Mac (15, 2)]
[Export ("cookiePartitionIdentifier", ArgumentSemantic.Copy), NullAllowed]
string CookiePartitionIdentifier { get; }
}

[BaseType (typeof (NSDictionary))]
Expand Down Expand Up @@ -8961,6 +8962,10 @@ interface NSMutableUrlRequest {
[Watch (11, 0), TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)]
[Export ("allowsPersistentDNS")]
bool AllowsPersistentDns { get; set; }

[TV (18, 2), iOS (18, 2), MacCatalyst (18, 2), Mac (15, 2)]
[Export ("cookiePartitionIdentifier", ArgumentSemantic.Copy), NullAllowed]
string CookiePartitionIdentifier { get; set; }
}

[BaseType (typeof (NSObject), Name = "NSURLResponse")]
Expand Down Expand Up @@ -10661,6 +10666,10 @@ interface NSHttpCookie {
[MacCatalyst (13, 1)]
[NullAllowed, Export ("sameSitePolicy")]
NSString SameSitePolicy { get; }

[TV (18, 2), iOS (18, 2), MacCatalyst (18, 2), Mac (15, 2)]
[Field ("NSHTTPCookieSetByJavaScript")]
NSString KeySetByJavaScript { get; }
}

[BaseType (typeof (NSObject), Name = "NSHTTPCookieStorage")]
Expand Down Expand Up @@ -10745,9 +10754,7 @@ interface NSHttpUrlResponse {
}

[BaseType (typeof (NSObject))]
#if MONOMAC
[DisableDefaultCtor] // An uncaught exception was raised: -[__NSCFDictionary removeObjectForKey:]: attempt to remove nil key
#endif
[DisableDefaultCtor]
partial interface NSBundle {
[Export ("mainBundle")]
[Static]
Expand Down Expand Up @@ -14965,7 +14972,7 @@ interface NSDateInterval : NSCopying, NSSecureCoding {
bool ContainsDate (NSDate date);
}

[DisableDefaultCtor] // -init should never be called on NSUnit!
[DisableDefaultCtor]
[MacCatalyst (13, 1)]
[BaseType (typeof (NSObject))]
interface NSUnit : NSCopying, NSSecureCoding {
Expand Down
1 change: 1 addition & 0 deletions tests/cecil-tests/Documentation.KnownFailures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58781,6 +58781,7 @@ P:Foundation.NSHttpCookie.KeySameSiteLax
P:Foundation.NSHttpCookie.KeySameSitePolicy
P:Foundation.NSHttpCookie.KeySameSiteStrict
P:Foundation.NSHttpCookie.KeySecure
P:Foundation.NSHttpCookie.KeySetByJavaScript
P:Foundation.NSHttpCookie.KeyValue
P:Foundation.NSHttpCookie.KeyVersion
P:Foundation.NSHttpCookieStorage.AcceptPolicyChangedNotification
Expand Down

This file was deleted.

4 changes: 0 additions & 4 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-Foundation.todo

This file was deleted.

This file was deleted.

This file was deleted.

6 comments on commit 509a063

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.