-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Right now in cacao all symbols are hardcoded and I personally believe there's no real reason for this, and if a symbol doesn't exist; you could just do it like how SwiftUI does it where it's just a blank image and it warns you that it doesn't exist if the OS doesn't support it
Because of this, this is currently how I am having to do SF symbols (if anyone does use this, please note that this isn't safe and will crash if the OS doesn't support it, in my app this doesn't really matter to me though)
pub fn symbol_from(system_name: &str) -> Image {
Image(unsafe {
let icon = NSString::new(system_name);
let desc = NSString::new("");
msg_send![class!(NSImage), imageWithSystemSymbolName:&*icon
accessibilityDescription:&*desc]
})
}Which works nicely, I can use symbols from Sequoia now in my Cacao app:
I am requesting that something similar to my function could maybe be included in Cacao to prevent any confusion; I'm not really sure what the best and cleanest way of integrating this would be but I think it could be discussed a little here; I personally like how SwiftUI does it again but ofcourse this isn't very rust-y
Image(systemName: "house.fill")