This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Combine | |
struct ContentView: View { | |
@State var id: Int = 0 | |
var body: some View { | |
VStack { | |
CounterView(from: 10).id(id) | |
Button("RESET") { id += 1 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
VStack(spacing: 20) { | |
Group { | |
// 💡 `spacing`は勝手に潰れない | |
HStack { | |
red() | |
blue() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
private let url = URL(string: "https://github.com/YusukeHosonuma")! | |
struct ContentView: View { | |
@State var isTargeted = false | |
@State var dropedURL: URL? | |
var body: some View { | |
VStack { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 元ツイート: | |
// https://twitter.com/tobi462/status/1529687893811556354?s=20&t=LUmtHH5wXylCFqTQpfgyVg | |
// | |
// ボーナス問題: | |
// https://twitter.com/tobi462/status/1529727505313124353?s=20&t=LUmtHH5wXylCFqTQpfgyVg | |
// | |
struct ContentView: View { | |
@State var text: String = "🍎" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State private var tick: Int = 0 | |
@State private var opacity: Double = 0 | |
@State private var inverse = true | |
var body: some View { | |
TimelineView(.animation) { timeline in | |
content(timeline.date) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🌱 Inspired by and special thanks! | |
// https://gist.github.com/Koshimizu-Takehito/737381f5e55678e691205fe11fe16e93 | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
HStack(spacing: 12) { | |
ForEach(["applelogo", "swift"], id: \.self) { name in | |
VStack(spacing: 12) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://tech.unifa-e.com/entry/2021/12/20/000000 | |
struct ContentView: View { | |
@State var colNum = 5 | |
@State var selection = 0 | |
var body: some View { | |
Group { | |
if selection == 0 { | |
CanvasGrid(colNum: colNum) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import Algorithms | |
struct ContentView: View { | |
var body: some View { | |
Text(attributedString()) | |
} | |
func attributedString() -> AttributedString { | |
var source = AttributedString(#""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 以下の記事について matchedGeoemetry を使用せずに書いたみた的なやつ。 | |
// https://hoshi0523.hatenablog.com/entry/2020/10/24/214520 | |
// | |
// 🍊 GeometryReader version. | |
// 🍎 AnchorPreference version. | |
// | |
import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import SwiftPrettyPrint | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
Group { | |
Text("1") | |
Text("2") | |
} |