Instance Property インスタンスプロパティ

icon

The icon that represents the file wrapper. ファイルラッパーを表すアイコン。

Declaration 宣言

var icon: NSImage? { get set }

Discussion 議論

You don’t have to use this icon; for example, a file viewer typically looks up icons automatically based on file extensions, and so wouldn’t need this one. Similarly, if a file wrapper represents an image file, you can display the image directly rather than a file icon. あなたは、このアイコンを使わなくてもかまいません;例えば、ファイルビューアは概してアイコンをファイル拡張子に基づき自動的に調べます、そういうわけでこれは必要ではありません。同様に、ファイルラッパーが画像ファイルを表すならば、あなたはファイルアイコンではなく、その画像を直接に表示できます。

This method may return nil if the file wrapper is a child created when its parent was read from the file system, and the child was modified before it was read. Use the NSFileWrapperReadingImmediate reading option to reduce the likelihood of that problem. このメソッドはnilを返すかもしれません、もしファイルラッパーが子で、それの親がファイルシステムから読み出された時に作成される、そして子がそれが読み出されるより前に修正されたならば。NSFileWrapperReadingImmediate読み出しオプションを使って、その問題の可能性を減少させてください。

Because the NSImage object that's returned might be shared by many FileWrapper objects, you must not mutate it. If you need to mutate the returned object, make a copy first and mutate the copy instead. 返されるNSImageオブジェクトが多くのFileWrapperオブジェクトによって共有されるかもしれないことから、あなたはそれを変化させてはいけません。あなたが返されるオブジェクトを変える必要があるならば、最初にコピーを作って、そしてコピーを代わりに変えてください。