One Quickie


Making a custom button style (SwiftUI->Random)
struct CustomButtonStyle: ButtonStyle {
    func makeBody(configuration: Configuration) -> some View {
        configuration.label
            .padding()
            .background(.purple)
            .foregroundStyle(.green)
            .clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
            .scaleEffect(configuration.isPressed ? 2.0 : 1)
            .animation(.easeOut(duration: 0.05), value: configuration.isPressed)
    }
}
(please don't actually make buttons with this style...) And then attach it to something (say an individual button, or a top-level view) like
        .buttonStyle(CustomButtonStyle())



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com