ã¯ããã«
ããŒã¿ã¯ã¢ããªã±ãŒã·ã§ã³éçºã®äžæ žãæãèŠçŽ ã§ãããããŒã¿ã®ç®¡çãšä¿ç®¡ã¯ã¢ããªã±ãŒã·ã§ã³ã®ä¿¡é Œæ§ãšå¹çæ§ã«å€§ãã圱é¿ããŸããç¹ã«ãã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ã«ãããŠã¯ãããŒã¿æ°žç¶åããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãåäžãããéèŠãªåœ¹å²ãæãããŸãããã®ã¬ã€ãã§ã¯ãAppleã®æ°ããUIãã¬ãŒã ã¯ãŒã¯ã§ããSwiftUIãå©çšããããŒã¿æ°žç¶åã®åºæ¬ããé«åºŠãªãã¯ããã¯ãŸã§ã解説ããŸãã
ãªãSwiftã®åºç€ã«ã€ããŠäžèšã®èšäºã§è©³çŽ°ã«è§£èª¬ããŠããŸãã
SwiftUIãšã¯
SwiftUIã¯ãAppleã2019幎ã«å°å ¥ããæ°ããUIãã¬ãŒã ã¯ãŒã¯ã§ãiOSãmacOSãwatchOSãtvOSã®åãã©ãããã©ãŒã ã§ã®ã¢ããªã±ãŒã·ã§ã³éçºããµããŒãããŠããŸããSwiftUIã¯éçºè ãç°¡æœãã€å¹ççã«ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ãŒã¹ãæ§ç¯ããããšãã§ããŸãããŸããSwiftUIã¯ãããŒã¿ãã€ã³ãã£ã³ã°ãšç¶æ 管çã®æ©èœãåããŠãããããã«ããããŒã¿ã®æµããæ確ã«ããã³ãŒãã®åå©çšãšä¿å®ã容æã«ãªããŸãã
ããŒã¿æ°žç¶åã®éèŠæ§
ããŒã¿æ°žç¶åã¯ãã¢ããªã±ãŒã·ã§ã³ã®ããŒã¿ããã£ã¹ã¯ãã¯ã©ãŠããªã©ã®æ°žç¶ã¹ãã¬ãŒãžã«ä¿åããã¢ããªã±ãŒã·ã§ã³ã®åèµ·åãããã€ã¹ã®åèµ·ååŸã§ãããŒã¿ãå©çšã§ããããã«ããããã»ã¹ãæããŸããããŒã¿æ°žç¶åã¯ä»¥äžã®ãããªå©ç¹ãæäŸããŸãã
- ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ã®åäž: ããŒã¿æ°žç¶åã«ããããŠãŒã¶ãŒã¯ã¢ããªã±ãŒã·ã§ã³ã®ç¶æ ãç¶æãã以åã®æäœãåéã§ãã
- ããŒã¿ã®å®å šæ§ã®ç¢ºä¿: ããŒã¿ã¯å®å šã«ä¿åãããã¢ããªã±ãŒã·ã§ã³ã®ãšã©ãŒãã¯ã©ãã·ã¥ããä¿è·ããã
- ãªãã©ã€ã³ã¢ã¯ã»ã¹ã®æäŸ: ããŒã¿æ°žç¶åã«ããããŠãŒã¶ãŒã¯ã€ã³ã¿ãŒãããæ¥ç¶ããªãå Žåã§ãã¢ããªã±ãŒã·ã§ã³ã®ããŒã¿ã«ã¢ã¯ã»ã¹ã§ãã
ããŒã¿æ°žç¶åã®çš®é¡
ããŒã¿æ°žç¶åã®ææ³ã¯å€å²ã«ããããéžæè¢ã¯ãããžã§ã¯ãã®èŠä»¶ãããŒã¿ã®çš®é¡ããããŠããŒã¿ã®éã«ãã£ãŠç°ãªããŸãã以äžã«ãäž»ãªããŒã¿æ°žç¶åã®ææ³ãããã€ã瀺ããŸã:
UserDefaults
- 軜éãªããŒã¿ã®ä¿åã«é©ããŠããŸã
- ããŒå€ã®ãã¢åœ¢åŒã§ããŒã¿ãä¿åããŸã
Core Data
- è€éã§é¢é£æ§ã®ããããŒã¿ã®ç®¡çã«é©ããŠããŸã
- ãªããžã§ã¯ãã°ã©ããšæ°žç¶ã¹ãã¬ãŒãžã®ç®¡çãæäŸããŸã
SQLite
- é¢ä¿ããŒã¿ããŒã¹ç®¡çã·ã¹ãã (RDBMS)ãšããŠåäœããSQLã¯ãšãªã䜿çšããŠããŒã¿ã管çããŸã
- 倧éã®ããŒã¿ãè€éãªããŒã¿æ§é ã®ä¿åã«é©ããŠããŸã
File System
- ãã¡ã€ã«ãšããŠããŒã¿ãä¿åãããã£ã¬ã¯ããªæ§é ã䜿çšããŠããŒã¿ãæŽçããŸã
- ãã€ããªããŒã¿ãããã¹ãããŒã¿ã®ä¿åã«é©ããŠããŸã
Cloud-Based Solutions (e.g., CloudKit, Firebase)
- ã¯ã©ãŠãããŒã¹ã®ããŒã¿æ°žç¶åãœãªã¥ãŒã·ã§ã³ã¯ãããŒã¿ã®ããã¯ã¢ãããšå ±æã容æã«ããŸã
- ã¯ã©ãŠããµãŒãã¹ã®å©ç¹ã掻çšããªãããã¢ããªã±ãŒã·ã§ã³ã®ããŒã¿ã管çããŸã
SwiftUIã§ã®ããŒã¿æ°žç¶åã®åºæ¬
ããŒã¿æ°žç¶åã¯ãã¢ããªã±ãŒã·ã§ã³ãçµäºããŠããŠãŒã¶ãŒããŒã¿ãä¿æããéèŠãªèŠçŽ ã§ããSwiftUIã§ã®ããŒã¿æ°žç¶åã®åºæ¬ã«ã€ããŠåŠã³ãUserDefaultsãCoreDataãããã³SQLiteã®åæè¡ãå©çšããæ¹æ³ã説æããŸãã
UserDefaultsã®å©çš
UserDefaultsã®åºæ¬
UserDefaultsã¯ãã·ã³ãã«ãªããŒã¿æ°žç¶åã®ããã®æè¡ã§ãå°ããªããŒã¿ã»ãããä¿åããã®ã«é©ããŠããŸããäž»ã«ãŠãŒã¶ãŒèšå®ããã©ã°ããã®ä»ã®åçŽãªããŒã¿ãä¿åããã®ã«çšããŸããUserDefaultsã¯ããŒ-å€ã®ãã¢ãä¿åããããšãã§ããã¢ããªã±ãŒã·ã§ã³ãçµäºãŸãã¯åèµ·åãããŠãããŒã¿ã¯ä¿æãããŸãã
UserDefaultsã®å®äŸ
以äžã®SwiftUIã³ãŒãã¹ããããã¯ãUserDefaultsãå©çšããŠããã¹ããã£ãŒã«ãã®å€ãæ°žç¶åããç°¡åãªäŸã瀺ããŠããŸãã
import SwiftUI
struct ContentView: View {
@AppStorage("username") var username: String = ""
var body: some View {
VStack {
TextField("Username", text: $username)
.padding()
Text("Hello, \(username)!")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
CoreDataã®å©çš
CoreDataã®åºæ¬
CoreDataã¯ããªããžã§ã¯ãã°ã©ããšæ°žç¶ã¹ãã¬ãŒãžã®ç®¡çãæäŸãããã¬ãŒã ã¯ãŒã¯ã§ãããé¢ä¿ããŒã¿ããŒã¹ã®ãããªæ©èœãæäŸããªããããé«ã¬ãã«ãªãªããžã§ã¯ãæåã®ã€ã³ã¿ãŒãã§ãŒã¹ãæã£ãŠããŸããCoreDataã¯ãè€éãªããŒã¿ã¢ãã«ãšé¢ä¿ãå¹æçã«ç®¡çã§ãã匷åãªããŒã«ã§ãã
CoreDataã®å®äŸ
以äžã¯ãSwiftUIãšCoreDataã䜿çšããŠåçŽãªãšã³ãã£ãã£ãäœæããã³ãã§ããããåºæ¬çãªäŸã§ãã
import SwiftUI
import CoreData
struct ContentView: View {
@Environment(\.managedObjectContext) private var moc
@FetchRequest(entity: Task.entity(), sortDescriptors: []) private var tasks: FetchedResults<Task>
var body: some View {
VStack {
List {
ForEach(tasks, id: \.self) { task in
Text(task.name ?? "Unknown")
}
}
Button(action: {
let task = Task(context: self.moc)
task.name = "New Task"
try? self.moc.save()
}) {
Text("Add Task")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
SQLiteã®å©çš
SQLiteã®åºæ¬
SQLiteã¯ã軜éã§èªå·±å®çµåã®é¢ä¿ããŒã¿ããŒã¹ãšã³ãžã³ã§ãããå€éšã®äŸåé¢ä¿ããªããèšå®ãäžèŠã§ããSQLiteã¯ãSQLã䜿çšããŠããŒã¿ãã¯ãšãªããç°¡åã«ããŒã¿ããŒã¹ãäœæããã³ç®¡çã§ããŸãã
SQLiteã®å®äŸ
以äžã®Swiftã³ãŒãã¹ããããã¯ãSQLiteããŒã¿ããŒã¹ãäœæããããŒãã«ãäœæããŠããŒã¿ãæ¿å ¥ããã³ååŸããåºæ¬çãªäŸã瀺ããŠããŸãã
import SQLite3
var db: OpaquePointer?
let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
.appendingPathComponent("TestDatabase.sqlite")
if sqlite3_open(fileURL.path, &db) != SQLITE_OK {
print("error opening database")
}
if sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS Test (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)", nil, nil, nil) != SQLITE_OK {
let errmsg = String(cString: sqlite3_errmsg(db)!)
print("error creating table: \(errmsg)")
}
var statement: OpaquePointer?
if sqlite3_prepare_v2(db, "INSERT INTO Test (name) VALUES ('Test name')", -1, &statement, nil) == SQLITE_OK {
if sqlite3_step(statement) == SQLITE_DONE {
print("Successfully inserted row.")
} else {
print("Could not insert row.")
}
} else {
print("INSERT statement could not be prepared.")
}
sqlite3_finalize(statement)
if sqlite3_exec(db, "SELECT * FROM Test", nil, nil, nil) != SQLITE_OK {
let errmsg = String(cString: sqlite3_errmsg(db)!)
print("error querying table: \(errmsg)")
}
sqlite3_close(db)
é«åºŠãªããŒã¿æ°žç¶åæè¡
ããŒã¿æ°žç¶åã®åºæ¬ãç解ããäžã§ããããªãæè¡ãæ¢æ±ããŠã¢ããªã±ãŒã·ã§ã³ã®æ§èœãåäžãããããšãéèŠã§ãããã®ã»ã¯ã·ã§ã³ã§ã¯ãéåæåŠçãããŒã¿ãã€ã³ãã£ã³ã°ãããã³CloudKitãšã®é£æºã«çŠç¹ãåœãŠãŠèª¬æããŸãã
éåæåŠçãšããŒã¿æ°žç¶å
éåæåŠçã®åºæ¬
éåæåŠçã¯ãã¡ã€ã³ã¹ã¬ããããããã¯ããã«æéããããæäœãå®è¡ããæ¹æ³ã§ããããã«ããããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ãŒã¹ã¯å¿çæ§ãä¿ã¡ããŠãŒã¶ãŒã¯ã¢ããªã±ãŒã·ã§ã³ãå¿«é©ã«äœ¿çšã§ããŸããéåæåŠçã¯ãããŒã¿ããŒã¹ã®ã¯ãšãªããããã¯ãŒã¯ãªã¯ãšã¹ãããã¡ã€ã«ã®èªã¿æžããªã©ãæéããããå¯èœæ§ã®ããæäœãããã¯ã°ã©ãŠã³ãã§å®è¡ããã®ã«åœ¹ç«ã¡ãŸãã
éåæåŠçãšããŒã¿æ°žç¶åã®é£æº
ããŒã¿æ°žç¶åã®æäœã¯ãã°ãã°æéãããããããéåæåŠçãšçµã¿åãããŠäœ¿çšããããšã§ãã¢ããªã±ãŒã·ã§ã³ã®æ§èœãåäžãããããšãã§ããŸãã以äžã®ã³ãŒãã¯ãSwiftUIãšéåæåŠçã䜿çšããŠããŒã¿ããŒã¹ã«ã¢ã¯ã»ã¹ããç°¡åãªäŸã瀺ããŠããŸãã
import SwiftUI
import Combine
struct ContentView: View {
@State private var data: [MyData] = []
var body: some View {
List(data, id: \.self) { item in
Text(item.name)
}
.onAppear {
fetchData()
}
}
func fetchData() {
DispatchQueue.global().async {
// Assume getDataFromDatabase is a function to fetch data from your database
let fetchedData = getDataFromDatabase()
DispatchQueue.main.async {
self.data = fetchedData
}
}
}
}
ããŒã¿ãã€ã³ãã£ã³ã°ãšæ°žç¶å
ããŒã¿ãã€ã³ãã£ã³ã°ã®åºæ¬
ããŒã¿ãã€ã³ãã£ã³ã°ã¯ããŠãŒã¶ãŒã€ã³ã¿ãŒãã§ãŒã¹ãšããŒã¿ã¢ãã«ãåæããããã¯ããã¯ã§ãããããŒã¿ã®å€æŽãèªåçã«UIã«åæ ãããUIã®å€æŽãããŒã¿ã¢ãã«ã«åæ ãããŸããSwiftUIã§ã¯ã@State
, @Binding
, @ObservedObject
, @EnvironmentObject
ãªã©ã®ããããã£ã©ãããŒã䜿çšããŠããŒã¿ãã€ã³ãã£ã³ã°ãå®è£
ã§ããŸãã
ããŒã¿ãã€ã³ãã£ã³ã°ãšããŒã¿æ°žç¶åã®é£æº
ããŒã¿ãã€ã³ãã£ã³ã°ãšããŒã¿æ°žç¶åãé£æºãããããšã§ãUIã®å€æŽãçŽæ¥ããŒã¿ããŒã¹ã«åæ ãããããŒã¿ããŒã¹ã®å€æŽãçŽæ¥UIã«åæ ãããããšãã§ããŸããããã«ãããããŒã¿ãšUIã®äžè²«æ§ãä¿ã¡ã€ã€ãã³ãŒãã®åé·æ§ãæžããããšãã§ããŸãã
import SwiftUI
import CoreData
struct ContentView: View {
@Environment(\.managedObjectContext) private var moc
@FetchRequest(entity: Task.entity(), sortDescriptors: []) private var tasks: FetchedResults<Task>
var body: some View {
List {
ForEach(tasks, id: \.self) { task in
TextField("Task name", text: Binding(
get: { task.name ?? "" },
set: { task.name = $0; try? self.moc.save() }
))
}
}
}
}
ããŒã¿ãã€ã³ãã£ã³ã°ã«ã€ããŠè©³ããã¯ãã¡ã
SwiftUIãšCloudKit
CloudKitã®åºæ¬
CloudKitã¯ãAppleã®iCloudãµãŒãã¹ãšé£æºããŠã¢ããªã±ãŒã·ã§ã³ããŒã¿ãä¿åããã³åæããããã®ãã¬ãŒã ã¯ãŒã¯ã§ããCloudKitã¯ãã¢ããªã±ãŒã·ã§ã³ã®ãŠãŒã¶ãŒããŒã¿ãå®å šã«ä¿åãããŠãŒã¶ãŒéã§ããŒã¿ãå ±æããæ©èœãæäŸããŸãã
SwiftUIãšCloudKitã®å®äŸ
以äžã®ã³ãŒãã¹ããããã¯ãSwiftUIãšCloudKitã䜿çšããŠããŒã¿ãã¯ã©ãŠãã«ä¿åããã³ååŸããç°¡åãªäŸã瀺ããŠããŸãã
import SwiftUI
import CloudKit
struct ContentView: View {
@State private var records: [CKRecord] = []
var body: some View {
List(records, id: \.recordID) { record in
Text(record["name"] as? String ?? "")
}
.onAppear {
fetchRecords()
}
}
func fetchRecords() {
let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: "Person", predicate: predicate)
let operation = CKQueryOperation(query: query)
operation.recordFetchedBlock = { record in
DispatchQueue.main.async {
self.records.append(record)
}
}
CKContainer.default().publicCloudDatabase.add(operation)
}
}
ããŒã¿æ°žç¶åã®ãã¹ããã©ã¯ãã£ã¹
ããŒã¿æ°žç¶åã®å®è£ ã«ãããŠãããã€ãã®ãã¹ããã©ã¯ãã£ã¹ãèæ ®ããããšã§ãã»ãã¥ãªãã£ãããã©ãŒãã³ã¹ãããã³ããŒã¿ã®æŽåæ§ãä¿è·ããåäžãããããšãã§ããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ããããã®ãã¹ããã©ã¯ãã£ã¹ã«çŠç¹ãåœãŠãŸãã
ã»ãã¥ãªãã£å¯Ÿç
ããŒã¿æå·å
ããŒã¿æå·åã¯ãäžæ£ãªã¢ã¯ã»ã¹ãããŒã¿æŒæŽ©ã®ãªã¹ã¯ã軜æžããããã®éèŠãªã»ãã¥ãªãã£å¯Ÿçã§ããæå·åã¯ãããŒã¿ãäžå¯è§£ãªåœ¢åŒã«å€æããç¹å®ã®ããŒãæã£ãŠãã人ã ããããŒã¿ã埩å·åããŠã¢ã¯ã»ã¹ã§ããããã«ããæè¡ã§ããiOSã§ã¯ãAppleã®File Encryptionããå€éšã©ã€ãã©ãªãå©çšããããšã§ããŒã¿æå·åãå®è£ ããããšãå¯èœã§ãã
ã¢ã¯ã»ã¹ã³ã³ãããŒã«
ã¢ã¯ã»ã¹ã³ã³ãããŒã«ã¯ãèªèšŒãšèªå¯ã®ããã»ã¹ãéããŠãç¹å®ã®ãŠãŒã¶ãŒãŸãã¯ã·ã¹ãã ãããŒã¿ã«ã¢ã¯ã»ã¹ã§ããããã«å¶åŸ¡ããŸããã¢ã¯ã»ã¹ã³ã³ãããŒã«ã¯ããŠãŒã¶ãŒãã¢ããªã±ãŒã·ã§ã³ã®ç¹å®ã®éšåãããŒã¿ã«ã¢ã¯ã»ã¹ã§ããããã«å¶éããäžæ£ã¢ã¯ã»ã¹ãé²ã圹å²ãæãããŸãã
ããã©ãŒãã³ã¹ãã¥ãŒãã³ã°
ã€ã³ããã·ã³ã°
ã€ã³ããã·ã³ã°ã¯ãããŒã¿ããŒã¹ã®ã¯ãšãªããã©ãŒãã³ã¹ãåäžãããæè¡ã§ãããç¹å®ã®åãŸãã¯å±æ§ã«ã€ã³ããã¯ã¹ãäœæããããšã§ãããŒã¿ã®æ€çŽ¢é床ãåäžãããŸããã€ã³ããã·ã³ã°ã¯ãããŒã¿ããŒã¹ã®æ§é ãæé©åããã¯ãšãªã®å¹çãåäžãããããã«éèŠã§ãã
ãããåŠç
ãããåŠçã¯ãåãçš®é¡ã®æäœãã°ã«ãŒãåããäžåºŠã«åŠçããæè¡ã§ãããããåŠçã¯ãããŒã¿ããŒã¹ã®ãã©ã³ã¶ã¯ã·ã§ã³ãå¹ççã«åŠçããã¢ããªã±ãŒã·ã§ã³ã®ããã©ãŒãã³ã¹ãåäžãããããšãã§ããŸãã
// CoreDataã®ãããæ¿å
¥ã®äŸ
let batchInsert = NSBatchInsertRequest(entity: Person.entity(), objects: arrayOfPersons)
do {
try context.execute(batchInsert)
} catch {
print("Batch insert error: \(error)")
}
å®éã®ãããžã§ã¯ãã§ã®ããŒã¿æ°žç¶åã®é©çš
ããŒã¿æ°žç¶åã¯ãã¢ããªã±ãŒã·ã§ã³éçºãããžã§ã¯ãã«ãããŠéèŠãªæ©èœã§ããããã®æåã¯ãããžã§ã¯ãå šäœã®æåã«çŽçµããŸãããã®ã»ã¯ã·ã§ã³ã§ã¯ãããŒã¿æ°žç¶åã®å®éã®ãããžã§ã¯ãã§ã®é©çšãšãæåäºäŸãäžè¬çãªåé¡ãšãã®è§£æ±ºçã«çŠç¹ãåœãŠãŸãã
äžè¬çãªåé¡ãšè§£æ±ºç
åé¡ç¹ãšå¯ŸåŠæ³
ããŒã¿æ°žç¶åã®å®è£ ã«ãããŠã¯ãããã©ãŒãã³ã¹ã®äœäžãããŒã¿ã®äžæŽåãã»ãã¥ãªãã£ã®åé¡ãªã©ãããŸããŸãªåé¡ãçºçããå¯èœæ§ããããŸãããããã®åé¡ã解決ããããã«ã¯ãé©åãªããŒã¿ã¢ãã«ã®èšèšããšã©ãŒãã³ããªã³ã°ã®å®è£ ãã»ãã¥ãªãã£å¯Ÿçã®åŒ·åãªã©ãå¿ èŠã§ãã
åžžèŠã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°
ããŒã¿æ°žç¶åã«é¢é£ãããã©ãã«ã·ã¥ãŒãã£ã³ã°ã¯ãããŒã¿ããŒã¹ã®ããã¯ãããŒã¿ã®äžæŽåãã¯ãšãªã®æé©åãªã©å€å²ã«ããããŸããå ·äœçãªåé¡ã«å¯ŸããŠã¯ããããã°ããŒã«ããã°ã掻çšããåé¡ã®åå ãç¹å®ã解決ããããšãéèŠã§ãããŸããã³ãã¥ããã£ãéçºè ãã©ãŒã©ã ãå©çšããŠãä»ã®éçºè ãšæ å ±ãå ±æããå©ããæ±ããããšãå¹æçã§ãã
ããŒã¿æ°žç¶åã®å®è£ ã¯ãã¢ããªã±ãŒã·ã§ã³ã®æåã«ãããŠéèŠãªèŠçŽ ã§ãããé©åãªæŠç¥ãšå®è£ ãæ±ããããŸãããŸããåžžã«æ°ããæè¡ããã¹ããã©ã¯ãã£ã¹ãåŠã³ããããžã§ã¯ãã«é©çšããããšã§ãããŒã¿æ°žç¶åã®å¹æãæ倧åããã¢ããªã±ãŒã·ã§ã³ã®å質ãåäžãããããšãå¯èœã§ãã
ãŸãšããšä»åŸã®å±æ
ããŒã¿æ°žç¶åã®éèŠæ§ã®å確èª
ããŒã¿æ°žç¶åã¯ãã¢ããªã±ãŒã·ã§ã³ã®ããŒã¿ãå®å šãã€å¹ççã«ç®¡çãããŠãŒã¶ãŒã«äŸ¡å€ãæäŸããåºç€ã圢æããŸããé©åãªããŒã¿æ°žç¶åã®æŠç¥ãšå®è£ ã¯ãã¢ããªã±ãŒã·ã§ã³ã®æ§èœãã»ãã¥ãªãã£ãããã³ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãåäžãããèŠçŽ ãšãªããŸãã
SwiftUIã§ã®ããŒã¿æ°žç¶åã®æªæ¥
æ°æè¡ã®å°å ¥
SwiftUIãšåãããŠäœ¿çšããæ°ããããŒã¿æ°žç¶åæè¡ããã¬ãŒã ã¯ãŒã¯ãç¶ç¶çã«ç»å ŽããŠããŸããããã«ãããããå¹ççãªããŒã¿ç®¡çãããé«éãªããã©ãŒãã³ã¹ããããŠããç°¡åãªããŒã¿æ°žç¶åã®å®è£ ãå¯èœã«ãªããŸãããŸããAppleèªèº«ãSwiftUIãšé£æºããæ°ããããŒã¿æ°žç¶åé¢é£ã®APIããã¬ãŒã ã¯ãŒã¯ãæäŸãç¶ããŠããããããã®æ°æè¡ã®å°å ¥ã¯SwiftUIã§ã®ããŒã¿æ°žç¶åãããã«åŒ·åããå¹çåããŸãã
ã³ãã¥ããã£ãšã®é£æº
SwiftUIãšããŒã¿æ°žç¶åã®æè¡ã«é¢ããã³ãã¥ããã£ã¯æŽ»çºã§ãããå€ãã®éçºè ãç¥èãçµéšãå ±æããŠããŸããã³ãã¥ããã£ãšã®é£æºã¯ãæ°ããã¢ã€ãã£ã¢ãååŸããåé¡ã解決ããããã«ã¯æ°ããããŒã¿æ°žç¶åã®æè¡ããã¬ãŒã ã¯ãŒã¯ãå ±åã§éçºããæ©äŒãæäŸããŸããå ¬éãã©ãŒã©ã ãGitHubãªããžããªããŸãã¯ã³ãã¥ããã£ã€ãã³ããéããŠãéçºè ã¯ããŒã¿æ°žç¶åã®ææ°ã®ãã¹ããã©ã¯ãã£ã¹ãšãã¬ã³ããæ¢æ±ããSwiftUIã®ããŒã¿æ°žç¶åã®ãšã³ã·ã¹ãã ãå ±ã«åäžãããããšãã§ããŸãã