skiptools / skiptools/skip-ui

Custom ButtonStyle not supported; `ButtonStyle` declaration incorrect

Open
#263 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

appearance compose
Dominant language
Swift
Stars
330
Forks
76
Avg merge
3h 6m
Merged PRs (30d)
1

Description

https://developer.apple.com/documentation/SwiftUI/ButtonStyle
https://www.avanderlee.com/swiftui/swiftui-button-styles/

ButtonStyle is a protocol, allowing you to implement its makeBody(configuration:) function to implement a custom button style.

SkipUI defines a struct called ButtonStyle with no makeBody implementation; it's basically an enum.

https://github.com/skiptools/skip-ui/blob/a72881a367d0d6a663796949a09d9666b8efde07/Sources/SkipUI/SkipUI/Controls/Button.swift#L231-L245

As a result, if you try to define a custom ButtonStyle with a makeBody implementation, Skip will spew a bunch of confusing errors ("Skip is unable to determine the owning type for member"); if you do manage to convince it it compile, it simply won't work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Sources/SkipUI/SkipUI/Controls/Button.swift at the ButtonStyle declaration linked in the issue, then compare it with SwiftUI's ButtonStyle protocol and its makeBody(configuration:) requirement. Confirm how custom styles are handled in SkipUI and verify that a style implementing makeBody can compile and work as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.