#StackBounty: #framework #user-interface #macos #swift What is the best alternative to SwiftUI for MacOS?

Bounty: 100

SwiftUI seems to have good features, but only works on MacOS 1.15 and newer. Is there a framework for MacOS that is efficient, and shares the capabilities of SwiftUI. Well technically, if I put everything in the draw() method of an NSView, it can in theory replicate all of the functionallity. However, it will be very difficult to replicate animating transitions. Another thing is, for some reason, drawing a single round-cornered rectange, like this:

    NSColor(red: 0.5, green: 1, blue: 1, alpha: 1).set()
    let Shape = NSBezierPath()
    let ActualY = (dirtyRect.height/2)
    let FarXOrigin = dirtyRect.width*0.75, CornerRadius = dirtyRect.width/96, Height = dirtyRect.width/20, CloseXOrigin = dirtyRect.width/4, ControlPointOffset = CornerRadius*0.552284749831, Y = ActualY+(Height/4)+CornerRadius
    Shape.move(to: NSMakePoint(FarXOrigin-CornerRadius, CGFloat(Y)))
    Shape.curve(to: NSMakePoint(FarXOrigin, CGFloat(Y)-CornerRadius), controlPoint1: NSMakePoint(FarXOrigin-CornerRadius+ControlPointOffset, CGFloat(Y)), controlPoint2: NSMakePoint(FarXOrigin, CGFloat(Y)-CornerRadius+ControlPointOffset))
    Shape.line(to: NSMakePoint(FarXOrigin, CGFloat(Y)-(CornerRadius+Height-(CornerRadius*2))))
    Shape.curve(to: NSMakePoint(FarXOrigin-CornerRadius, CGFloat(Y)-Height), controlPoint1: NSMakePoint(FarXOrigin, CGFloat(Y)-(CornerRadius+Height-(CornerRadius*2)+ControlPointOffset)), controlPoint2: NSMakePoint(FarXOrigin-CornerRadius+ControlPointOffset, CGFloat(Y)-Height))
    Shape.line(to: NSMakePoint(CloseXOrigin+CornerRadius, CGFloat(Y)-Height))
    Shape.curve(to: NSMakePoint(CloseXOrigin, CGFloat(Y)-(CornerRadius+Height-(CornerRadius*2))), controlPoint1: NSMakePoint(CloseXOrigin+CornerRadius-ControlPointOffset, CGFloat(Y)-Height), controlPoint2: NSMakePoint(CloseXOrigin, CGFloat(Y)-(CornerRadius+Height-(CornerRadius*2)+ControlPointOffset)))
    Shape.line(to: NSMakePoint(CloseXOrigin, CGFloat(Y)-CornerRadius))
    Shape.curve(to: NSMakePoint(CloseXOrigin+CornerRadius, CGFloat(Y)), controlPoint1: NSMakePoint(CloseXOrigin, CGFloat(Y)-CornerRadius+ControlPointOffset), controlPoint2: NSMakePoint(CloseXOrigin+CornerRadius-ControlPointOffset, CGFloat(Y)))
    Shape.close()
    Shape.fill()

takes up a LOT more memory than calling RoundedRectangle() MULTIPLE times in SwiftUI. Also the edges in the SwiftUI round rectangle look sharp, and when drawing in an NSView, the edges look slightly less well defined. I want a backwards-compatible framework that can do custom drawing EFFICIENTLY, and that I do not have to recreate too many features. What should I do? How would I create a very lightweight user interface with all the features that SwiftUI can do?


Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.