-
Notifications
You must be signed in to change notification settings - Fork 389
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
Can I use this framework for Mac OSX application? #3
Comments
I've never messed with OSX applications before, but I do believe that the origin { 0,0 } is different on OSX apps than iOS apps, lower-left vs. upper-left respectively, so I'm guessing it would not work out of the box, although I'm looking into making a simple fix that will make it work properly on both. |
Thanks for your working. Hoping you will completer this framework for both, iOS & OSX. |
Would love to use this framework on OS X. Please let me know if you make any progress on that front. |
Neon looks like a great framework ! I installed it into my project via Carthage this morning, and have been trying to figure out why the subview I've been trying to anchor to the top edge kept showing up centered on the left side with half of the view offscreen. I just realized that the coordinate system on OS X must be different from iOS.. Lol. |
Yeah @thomjordan I still need to look into making this work out of the box for both systems. |
Great to hear, thanks for the update ! |
There's a read-only Bool property in NSView called It defaults to false but can be overridden in a custom subclass of NSView or within an extension to an existing subclass of NSView: public class NSFlippedView : NSView {
override public var flipped: Bool {
return true
}
}
extension NSTextField {
override public var flipped: Bool {
return true
}
} After setting these, Neon now seems to be working perfectly on OS X as far as I can tell, at least within the scope of my limited use of it yesterday. I should be trying out more of the framework over the next few days. BTW, a quick way to utilize existing NSView-derived classes whose content might depend on the traditional coordinate system is to set the frame and bounds of an traditional view instance to however you want it to look, then add it as a subview of a fresh NSFlippedView object, setting its frame and bounds to fit the size of the inner object's frame, and their origins to (0,0). Neon then can correctly utilize the outer NSFlippedView while the frame and bounds of the inner object may be adjusted in the old coordinate system if needed. I've done this with a few custom view classes and it's been working outstandingly well ! Thanks for sharing this amazing and long needed framework. |
@thomjordan That is awesome! Any chance you'd be able to throw that in a pull request? |
I can sure try.. I'm not that familiar with Git yet but I can look into it On Sun, Nov 8, 2015 at 5:19 PM, Mike Amaral [email protected]
|
@thomjordan No problem, let me know if you need any assistance. |
I forked Neon to my GitHub page, then cloned it to my local system. On my local copy, I added some lines to the #ifdef in Neon.swift, a few times, but each time I save, close then open the file again the changes are gone. I think I know now how to do the rest, submitting the pull request, etc. I just seem to be stuck on this one part.. how to be able to make changes in the first place. There's no diffs available to be staged either. I tried working directly from the clone, and I also tried do a separate checkout after the clone. I've got to be missing something very obvious. I'll try again tomorrow. |
I've seen very good results using this version of Neon modified for OS X. I still haven't figured out how to initiate pull requests in Git, so instead here's a zip attachment of the Neon source folder circa mid-November 2015, modified for the default OS X coordinate system with a lower-left origin. I basically just switched around some of the enum cases and turned some "+" signs into "-", et al. It took less than an hour which was surprising, becoming largely mechanical once deciding on a short sequence of steps for repeatedly applying the geometrical reflection within the code. Since then any time I've used the module in OS X I've seen no errors or unpredictable behavior. In the zip archive below, the source files show where each modification was made, by commenting out and preserving the original expressions made for the iOS coordinate system. Thanks for creating Neon and sharing it on here ! |
@thomjordan Excellent, I'll see what you did there and see if I can conditionalize it. Honestly, the reason why I haven't done this yet is because I've actually never built an OSX app, and have no idea how to set it up with a simple widow for testing. I spent like 30 minutes one night last year and gave up, then forgot about it since. |
I used Neon to help achieve a quick, balanced UI look early on within this large-scale application I'm working on, and then moved on to other areas of the app. I'm in the midst of some heavy refactoring this week, and looking back at some previously-written code it's obvious to me now that I've achieved better, more consistent results using Neon than what I could get using Auto Layout, and much more quickly too. I recently got NSStackView working correctly with the right settings of Auto Layout constraints for my project, and I can see using a mixture of stack views and Neon to achieve some truly superb results. Thanks again ! |
@thomjordan Thanks for the feedback! :) |
Dear,
Neon is really excellent framework for UI design. But I do not know it is possible for mac os application or not?
Thanks.
The text was updated successfully, but these errors were encountered: