MrKai77 / DynamicNotchKit

Seamlessly adapt your macOS app to the notch era.
MIT License
120 stars 9 forks source link

the example in the readme #1

Closed OnlywaitY closed 5 months ago

OnlywaitY commented 5 months ago

I saw this example in the readme and I really like it, is this just a gif for display? Or do you have the source code to achieve this effect through this project? Can you provide it? Thank you for your help. battery

MrKai77 commented 5 months ago

Sure! You can achieve this effect like this:

let view = ProgressRing(to: .constant(0.8), color: .green)
    .overlay {
        Text("80%")
            .font(.caption)
            .foregroundStyle(.secondary)
    }

let dynamicNotch = DynamicNotchInfo(
    iconView: view,
    title: title,
    description: description
)

dynamicNotch?.show(for: seconds)

I haven't documented ProgressRing in depth yet, but it is included in the project :)

Let me know if you have any other questions!