pub struct Font(/* private fields */);Expand description
A reusable SwiftUI.Font.
Building a font is expensive — SwiftUI resolves it through the text system, which costs tens of microseconds — while applying one costs a few hundred nanoseconds. Building it once and reusing the handle is the difference between roughly 66 µs and 0.4 µs per view.
ⓘ
let title = Font::system(28.0, Some(Weight::Bold), None);
let ui = vstack![
text("Heading").font_ref(&title),
text("Another").font_ref(&title),
];Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnsafeUnpin for Font
impl UnwindSafe for Font
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more