Skip to content

[Appkit] Bindings - part 2 - #7215

Merged
prmallic merged 33 commits into
dotnet:xcode11.2from
prmallic:AppKit-xcode11-b1-2
Oct 18, 2019
Merged

prmallic merged 33 commits into
dotnet:xcode11.2from
prmallic:AppKit-xcode11-b1-2

Conversation

@prmallic

@prmallic prmallic commented Oct 10, 2019 •

Copy link
Copy Markdown
Contributor

Rebased on PR#7187.

@prmallic prmallic added the enhancement The issue or pull request is an enhancement label Oct 10, 2019
@monojenkins

Copy link
Copy Markdown
Contributor

Build failure
✅ Build succeeded
⚠️ Mono built from source
✅ API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
🔥 Test run failed 🔥

Test results

1 tests failed, 90 tests passed.

Failed tests

  • introspection/Mac Modern/Debug: Failed (Test run failed.)

@monojenkins

Copy link
Copy Markdown
Contributor

Build success
✅ Build succeeded
⚠️ Mono built from source
✅ API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
✅ Test run succeeded

@prmallic
prmallic force-pushed the AppKit-xcode11-b1-2 branch from 30f76cb to 985e707 Compare October 14, 2019 18:17
Comment thread src/appkit.cs Resolved
Comment thread src/appkit.cs Outdated

[Static]
[Export ("layoutAnchorWithEdges:fractionalOffset:")]
NSCollectionLayoutAnchor LayoutAnchorWithEdgesFractionalOffset (NSDirectionalRectEdge edges, CGPoint fractionalOffset);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think GetLayoutAnchor sounds better.

Comment thread src/appkit.cs
{
[Static]
[Export ("fractionalWidthDimension:")]
NSCollectionLayoutDimension CreateFractionalWidthDimension (nfloat fractionalWidth);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as it is - it's not With, it's Width (same goes for the others below).

Comment thread src/appkit.cs Outdated

[Export ("imageAtIndex:")]
[return: NullAllowed]
NSImage ImageAtIndex (nint index);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a verb, sounds more like C#, and is also symmetrical to SetImage:

Suggested change
NSImage ImageAtIndex (nint index);
NSImage GetImage (nint index);

Comment thread src/appkit.cs Outdated

[Export ("labelAtIndex:")]
[return: NullAllowed]
string LabelAtIndex (nint index);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same:

Suggested change
string LabelAtIndex (nint index);
string GetLabel (nint index);

Comment thread src/appkit.cs Outdated
void SetEnabled (bool enabled, nint index);

[Export ("isEnabledAtIndex:")]
bool IsEnabledAtIndex (nint index);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same:

Suggested change
bool IsEnabledAtIndex (nint index);
bool GetEnabled (nint index);

Comment thread src/appkit.cs Outdated
bool IsEnabledAtIndex (nint index);

// @property (readwrite, copy) NSString * _Null_unspecified customizationLabel;
[Export ("customizationLabel")]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArgumentSemantic.Copy is important, and shouldn't be skipped (the copy part from the Objective-C property declaration above)

Suggested change
[Export ("customizationLabel")]
[Export ("customizationLabel", ArgumentSemantic.Copy)]

Comment thread src/appkit.cs Outdated
NSCollectionLayoutSize Create (NSCollectionLayoutDimension width, NSCollectionLayoutDimension height);

[Export ("widthDimension")]
NSCollectionLayoutDimension Width { get; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think WidthDimension sounds just as good as Width, and it has the advantage of being identical to Swift/Objective-C, so I would go with WidthDimension here.

Suggested change
NSCollectionLayoutDimension Width { get; }
NSCollectionLayoutDimension WidthDimension { get; }

Comment thread src/appkit.cs Outdated
NSCollectionLayoutDimension Width { get; }

[Export ("heightDimension")]
NSCollectionLayoutDimension Height { get; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same:

Suggested change
NSCollectionLayoutDimension Height { get; }
NSCollectionLayoutDimension HeightDimension { get; }

Comment thread src/AppKit/NSCollectionLayoutAnchor.cs Outdated
}

public partial class NSCollectionLayoutAnchor {
public static NSCollectionLayoutAnchor GetLayoutAnchor (NSDirectionalRectEdge edges, NSCollectionLayoutAnchorOffsetType offsetType, CGPoint offset) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general (I did not read the associated doc) when type 'X' has static members that returns 'X' then it's more a Create than a Get, e.g.

public class Url {
   // good
   static Url Create (string url) { ... }
   // bad
   static Url Get (string url) { ... }

   // good
   static string GetDomain (Url url) { ... }
   // bad
   static string CreateDomain (Url url) { ... }
}

Comment thread src/appkit.cs Outdated
{
[Export ("initWithIdentifier:")]
[DesignatedInitializer]
IntPtr Constructor (string identifier);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not this be NSTouchBarItemIdentifier (not string) ?

Comment thread src/frameworks.sources Outdated
UIKit/UIPrintInteractionController.cs \
UIKit/UIStringAttributes.cs \
UIKit/UITypes.cs \
XKit/Types.cs \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misaligned - tabs vs spaces?

@prmallic

Copy link
Copy Markdown
Contributor Author

So removing the above .ctor ([DesignatedInitializer]) from NSPickerTouchBarItem and adding the skip case to the test. Thanks @dalexsoto!

@prmallic
prmallic requested a review from spouliot October 16, 2019 21:43
@monojenkins

Copy link
Copy Markdown
Contributor

Build failure
✅ Build succeeded
⚠️ Mono built from source
✅ API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
🔥 Test run failed 🔥

Test results

# Test run in progress: NotStarted: 70, Failed: 21, Ignored: 960

Failed tests

  • apitest/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • dont link/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • introspection/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • xammac tests/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • xammac tests/Mac Modern/Release: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • xammac tests/Mac Modern/Release: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • link all/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • link all/Mac Modern/Release: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • link sdk/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • link sdk/Mac Modern/Release: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • mono-native-compat/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • mono-native-unified/Mac Modern/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • apitest/Mac Full/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • dont link/Mac Full/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • dont link/Mac System/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • mono-native-compat/Mac Full/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • mono-native-unified/Mac Full/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • Xtro/Mac: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • MSBuild tests/iOS: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • Install Sources tests/iOS: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)
  • MSBuild tests/macOS/Debug: Failed (Not enough space on the root drive '/': MB left of 1024 MB required)

// Explicitly disabled ctors - (instancetype)init NS_UNAVAILABLE;
return true;
case "NSPickerTouchBarItem":
if (ctor.ToString () == $"Void .ctor(System.String)")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a comment why this ctor is being disabled (like the above cases already have)

there's nothing in /Applications/Xcode112-beta2.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSPickerTouchBarItem.h to suggest it should not be available.

@monojenkins

Copy link
Copy Markdown
Contributor

Build success
✅ Build succeeded
⚠️ Mono built from source
✅ API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
✅ Test run succeeded

@prmallic

prmallic commented Oct 17, 2019 •

Copy link
Copy Markdown
Contributor Author

Also, the Xtro here generates double names. issue - #2029

@monojenkins

Copy link
Copy Markdown
Contributor

Build success
✅ Build succeeded
⚠️ Mono built from source
✅ API Diff (from stable)
ℹ️ API Diff (from PR only) (please review changes)
ℹ️ Generator Diff (please review changes)
✅ Test run succeeded

Comment thread src/XKit/Types.cs Resolved
@prmallic
prmallic merged commit dc72d59 into dotnet:xcode11.2 Oct 18, 2019
@prmallic
prmallic deleted the AppKit-xcode11-b1-2 branch October 18, 2019 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement The issue or pull request is an enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants