skiptools / skiptools/skip-ui

Implement .onPreferenceChange...

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

Nobody has claimed this yet.

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

Description

I have a fairly complex layout scenario which would benefit from the following technique (scroll down to "Using a preference key"):

https://swiftbysundell.com/questions/syncing-the-width-or-height-of-two-swiftui-views/

I use this in my iOS code and it works well.

Unfortunately, while Skip does seem to support PreferenceKey generally, .onPreferenceChange is not supported. This prevents me from being able to get the CGSize of a view and use it for calculations as needed.

Would it be possible to implement .onPreferenceChange?

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 by reviewing the existing PreferenceKey support and the entry point for SwiftUI view modifiers. Use the linked “Using a preference key” example as the behavioral reference, and verify that .onPreferenceChange can receive a CGSize value for layout calculations.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.