-1

I found this declaration in Apple's API reference but I'm not sure how to use it.

func createFile(atPath path: String, contents data: Data?, attributes attr: [String : Any]? = nil) -> Bool

When I start typing createFile, there is no auto-complete that resembles this declaration either.

My path is a directory on my computer (not including the file's name), and the data is a string.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
ludluck
  • 127
  • 9

1 Answers1

1

It works fine on my machine. You probably just aren't using a FileManager object:

enter image description here

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • You are right thank you. And I am just using the simulator. – ludluck Nov 08 '16 at 18:26
  • No offence to you or professionals, but can I just not play around? – ludluck Nov 08 '16 at 18:31
  • @matt did you try it? I am able to access even the root directory of my mac .. I am able to create there a file and read and write to/from it running an iOS application in the simulator. By the way, there are no words about ios or iPhone in the question ... The same syntax I use at macOS ... – user3441734 Nov 08 '16 at 19:27