YogaKit macOS support? #589

Closed
opened 2017-07-04 22:55:56 -07:00 by crossle · 6 comments
crossle commented 2017-07-04 22:55:56 -07:00 (Migrated from github.com)

How about support macOS?

How about support macOS?
d16r commented 2017-07-28 10:14:20 -07:00 (Migrated from github.com)

It's not on our roadmap at the moment, but I'd love a PR!

It's not on our roadmap at the moment, but I'd love a PR!
joemcbride commented 2018-06-19 23:51:39 -07:00 (Migrated from github.com)

I spent some time getting a macOS version working here: https://github.com/joemcbride/YogaKit

The sample project currently targets Xcode 8.2.1 since the project I plan on using it with is stuck on that at the moment.

I'm not familiar with what the typical pattern would be to create a multi-targeted library, though I would be willing to make an attempt if someone can point me in the right direction. I'm mostly unsure if we could re-design some of the classes (looking at you YGLayout) that depend on UIView / NSView or if it would be mostly duplicate code. There are a few differences between the two but it was mostly just renaming UIView to NSView in YGLayout. This could easily be done by introducing a protocol though I don't think that would be the best fit.

macOS also does not have sizeThatfits so I'm not 100% sure of the implications of that yet, though initial basic scenarios seem to be behaving as expected.

This may or may not be a bit moot with Apple's announcement of running iOS in macOS (bye AppKit??), though I wanted to start using this now.

I spent some time getting a macOS version working here: https://github.com/joemcbride/YogaKit The sample project currently targets Xcode 8.2.1 since the project I plan on using it with is stuck on that at the moment. I'm not familiar with what the typical pattern would be to create a multi-targeted library, though I would be willing to make an attempt if someone can point me in the right direction. I'm mostly unsure if we could re-design some of the classes (looking at you `YGLayout`) that depend on `UIView` / `NSView` or if it would be mostly duplicate code. There are a few differences between the two but it was mostly just renaming `UIView` to `NSView` in `YGLayout`. This could easily be done by introducing a protocol though I don't think that would be the best fit. macOS also does not have `sizeThatfits` so I'm not 100% sure of the implications of that yet, though initial basic scenarios seem to be behaving as expected. This may or may not be a bit moot with Apple's announcement of running iOS in macOS (bye AppKit??), though I wanted to start using this now.
alexdrone commented 2018-06-20 01:12:30 -07:00 (Migrated from github.com)

macOS also does not have sizeThatfits so I'm not 100% sure of the implications of that yet, though initial basic scenarios seem to be behaving as expected.

This could be implemented as:

- (CGSize)sizeThatfits:(CGSize)size {

  CGSize sizeThatFits = self.fittingSize;
  sizeThatFits.width = MIN(sizeThatFits.width, size.width);
  sizeThatFits.height = MIN(sizeThatFits.height, size.height);
  return sizeThatFits;
}
> macOS also does not have sizeThatfits so I'm not 100% sure of the implications of that yet, though initial basic scenarios seem to be behaving as expected. This could be implemented as: ``` - (CGSize)sizeThatfits:(CGSize)size { CGSize sizeThatFits = self.fittingSize; sizeThatFits.width = MIN(sizeThatFits.width, size.width); sizeThatFits.height = MIN(sizeThatFits.height, size.height); return sizeThatFits; } ```
joemcbride commented 2018-06-20 06:52:33 -07:00 (Migrated from github.com)

@alexdrone Thanks! I'm still learning cocoa so that is super helpful.

@alexdrone Thanks! I'm still learning cocoa so that is super helpful.
cntrump commented 2019-06-13 21:30:16 -07:00 (Migrated from github.com)
my PR https://github.com/facebook/yoga/pull/913
NickGerleman commented 2023-06-13 08:04:23 -07:00 (Migrated from github.com)

We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.

We are deprecating YogaKit as part of the Yoga 2.0 release. We are still going to release a new revision based on the current state of the repo, but won't be accepting new contributions, since we are going to be removing it from the repo after.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DaddyFrosty/yoga#589
No description provided.