blackbeltlabs / TextAnnotation

Swift text annotation component for macOS.
MIT License
5 stars 2 forks source link

SwiftUI based previews based on real screenshots and different text settings #20

Open mirkokiefer opened 4 years ago

mirkokiefer commented 4 years ago

Let's define a file in Xcode with ten different text renderings based on real world screenshots and different font settings. This way we can quickly iterate on ideal results.

Ideally, we could even automate saving those views via a CI tool (Travis or move to Github Actions - whichever is easier) for previewing those on Github.

ulian-onua commented 4 years ago

@mirkokiefer where should we take these screenshots from? Should we paste several real-world screenshots images to the bundle?

About automation need to R&D if it is possible.

mirkokiefer commented 4 years ago

@ulian-onua yes let's just add some to the bundle - not packaged with the release though. Just pick a few for now - I can help replace with other ones later. Also let's not focus on the automation piece now - if we can see the SwiftUI previews that should be fast enough to play with the parameters.

ulian-onua commented 4 years ago

@mirkokiefer got it. I'll prepare them with a possibility to paste different attributes ([NSAttributedString.Key) that should allow us to play with different default settings.

ulian-onua commented 4 years ago

@mirkokiefer please check this branch update/solid_outline with the SwiftUI previews done. The current SwiftUI previews are based on shadow and outline (strokeWidth and strokeColor) properties customization.

Please check TextContainerView_Preview file to view the previews. I added some comments there for clarification.

You can change static var defaultColor: NSColor? to set text color for all previews. This will be applied to all previews if the color is not overridden by a certain preview. You can use TextColor.swift to get all current colors that Zappy app uses. TextColor is convertible to NSColor and vise versa.

You can change static var defaultImageName: String to change the background image of previews. Currently zapier_screenshot and zapier_screenshot2 is available.

If these settings are changes you will need to press "Resume" button on preview canvas image

The settings of views inside the preview view can be changed on fly