-
-
Save GJNilsen/3d960caf924c25c67c0e967bdcf2c51a to your computer and use it in GitHub Desktop.
Swift 4.2 changes:
NSRectClip(textRect) => textRect.clip()
let textFontAttributes : [ NSAttributedString.Key : Any ] = [
.font: NSFont(name: "SFUIText-Medium", size: NSFont.systemFontSize)!,
.foregroundColor: NSColor.white,
.paragraphStyle: textStyle
]
Thanks for the code, it is helpful. One thing I noticed on Mojave is we need to add below code to accurately render the dimensions when you are controlling the size of the button using NSLayoutConstraint
self.bezelStyle = .shadowlessSquare
@krishongithub Ill update the code to Swift 5 when Catalina drops.
If we can have this updated to the latest version, it would be really helpful.
I deleted the comment because I found some time to update the code anyway. I would just recommend reading the documentation provided by Apple. The HIG is the go to resource for that.
https://developer.apple.com/design/human-interface-guidelines/macos/overview/themes/
I would recommend StackOverflow for specific questions.
Even SwiftUI is in it's infancy and has a lot of bugs and frustrating constraints, the power of coding the same "language" for all devices across the Apple ecosystem is a real plus. I say "language", because the difference between iOS, tvOS, macOS and watchOS for that sake, is so far from each other that it's almost like different dialects of the same language. So for better or worse, I went all inn for SwiftUI.
It helps me a lot, thank you so much!
Thanks, very helpful