Taehyeon-Kim / Taehyeon-Kim.github.io

The life of recording is unbreakable
https://taehyeon-kim.github.io
MIT License
1 stars 0 forks source link

VisionOS101: Hover Effect #40

Open Taehyeon-Kim opened 9 months ago

Taehyeon-Kim commented 9 months ago
Button(action: {}) {
  VStack(alignment: .leading) {
    Color.clear
      .background(.regularMaterial)
      .clipShape(.rect(cornerRadius: 10))

    HStack(spacing: 0) {
      VStack(alignment: .leading, spacing: 0) {
        Text("Title")

        Text("Description")
          .foregroundStyle(.secondary)
      }

      Spacer()

      Button(action: {}) {}
        .frame(width: 28, height: 28)
        .clipShape(.circle)
        .overlay {
          Image(systemName: "ellipsis")
        }
    }
  }
  .padding(16)
  .contentShape(.hoverEffect, .rect(cornerRadius: 20))
  .hoverEffect()
}
.buttonStyle(.plain)
Taehyeon-Kim commented 9 months ago

https://stackoverflow.com/questions/77796320/how-to-customize-hover-effect-region-in-visionos