liveview-native / liveview-native/liveview-client-swiftui

Support passing view references in `AnyShape` implementation

Open
#1,326 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
440
Forks
45
PR merge metrics
No merged PRs in 30d

Description

To convert the following SwiftUI example into the LVN DSL

Image("turtlerock")
  .clipShape(Circle())

I wanted to pass a Circle view to the clipShape modifier using the template attribute like so:

Template

<Image class="image" name="turtlerock">
    <Circle template="example"/>
</Image>

Stylesheet

defmodule LvnWorkshopWeb.Styles.SwiftUI do
  use LiveViewNative.Stylesheet, :swiftui

  ~SHEET"""
  "image" do
    clipShape(shape: :example)
  end
  """
end

However @carson-katri informed me we don't support that syntax, and only support the list of standard shapes: https://developer.apple.com/documentation/swiftui/shape

So we can convert the following syntax into the LVN DSL:

Image("turtlerock")
  .clipShape(.circle)

But not the original syntax used in the example:

Image("turtlerock")
  .clipShape(Circle())

Contributor guide

No contributing guide indexed for this repository

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 locating the AnyShape implementation and the handling of the clipShape modifier and template references. Compare the supported standard-shape syntax with the requested Circle view reference, then determine the changes needed for the template example to work. Done means the original Image and Circle template can produce the equivalent clipShape behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.