*https://developer.apple.com/documentation/xcode/adding_capabilities_to_your_app
[[File:swift_macos_net_error.png|600px]]
==File==
===JSONにシリアライズしてドキュメントディレクトリへ書き出し===
*データ(Codableを適用する)
<pre>
struct Host : Codable {
var host: String = ""
var ip: String = ""
var macaddr: String = ""
}
</pre>
*書き出し処理
<pre>
let docPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let filePath = URL(fileURLWithPath: "hosts.json", relativeTo:docPath)
let encoder = JSONEncoder()
do {
let line = try encoder.encode(host)
try line.write(to: filePath)
} catch {
print(error)
}
</pre>
==UI==
}
</pre>
==処理==
===サブプロセスを起動===