Skip to content

Instantly share code, notes, and snippets.

View soaringkonoha's full-sized avatar
🏠
Working from home

soaringkonoha soaringkonoha

🏠
Working from home
  • Tokyo, JP
  • 13:15 (UTC +09:00)
View GitHub Profile

State

A property wrapper type that can read and write a value managed by SwiftUI. https://developer.apple.com/documentation/swiftui/state

@State

In a View's struct, you can't change a value of properties directly, whereas a wrapped property using @State attribute can be changed its value by SwiftUI. State properties change, then SwiftUI re-renders the View that refers to these.

@soaringkonoha
soaringkonoha / GenericsOverview.rs
Created January 13, 2022 12:09
ジェネリクスの基礎概要
// 具象型 A
struct A;
// A より先に <A> がない。
// また、A は具象型である。
// よって Single も具象型になる。
struct Single(A);
// T よりも先に <T> が使用されている。
// よって型パラメータ T はジェネリック型である。