Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sources/Splash/Theming/Font.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ public struct Font {
resource = .system
self.size = size
}

/// Initialize an instance with an existing, custom, font.
public init(font: Loaded) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we can drop the external parameter label, so rather than:

Font(font: nativeFont)

It would be:

Font(nativeFont)

Or what do you think @terhechte?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or, an alternative design would be to use something inspired by RawRepresentable, and name the external parameter label rawFont, or nativeFont.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like it. Makes it clearer. If you're fine with this change, I'd check out the repo and create a proper PR, seems CI failed (I did the editing right on Github, so I never tried to compile it ;)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds great! 👍

resource = .preloaded(font)
self.size = font.pointSize
}
}

public extension Font {
Expand Down