0
私は今、Swift(ちょっとした趣味)を勉強していて、ドキュメントベースの迅速なアプリケーションでdocument.swiftファイルに関数を読み込んで保存する方法を理解しようとしていますか?単純なtxtファイルを保存して読み込む方法を知りたい。私はNSTextViewを使用しているので、NSStringに変更する必要があると思いますか?ここで 文書ベースのSwift 3アプリに簡単なセーブロード機能を追加するにはどうすればいいですか?
は、現時点では、これらの機能は:override func data(ofType typeName: String) throws -> Data {
// Insert code here to write your document to data of the specified type. If outError != nil, ensure that you create and set an appropriate error when returning nil.
// You can also choose to override fileWrapperOfType:error:, writeToURL:ofType:error:, or writeToURL:ofType:forSaveOperation:originalContentsURL:error: instead.
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
override func read(from data: Data, ofType typeName: String) throws {
// Insert code here to read your document from the given data of the specified type. If outError != nil, ensure that you create and set an appropriate error when returning false.
// You can also choose to override readFromFileWrapper:ofType:error: or readFromURL:ofType:error: instead.
// If you override either of these, you should also override -isEntireFileLoaded to return false if the contents are lazily loaded.
throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
ありがとうございます!私はそれに入り、問題があるかどうかを報告します。 – paha