Skip to content

[Foundation] Implement Xcode 16.2 beta 1-3 changes. #21711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -58766,6 +58766,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.