-2

is there any way to create swift files programmatically using command line tool
I have to create a set of files with specific code in it based on the inputs given I have to use swift command line tool to generate swift files can anyone help me with your suggestions I need the code in swift i have to write a swift command line applications which generates a set of swift files

John Bollinger
  • 160,171
  • 8
  • 81
  • 157

2 Answers2

1

If you only need to create swift file you can try touch fileName.swift command.

You can create multiple files by touch file1.swift file2.swift or if there is any sequence in file names you can try touch file{1..5}.swift.

And then using echo command to fill file with code.

pacification
  • 5,838
  • 4
  • 29
  • 51
0

You can create a swift files in command line by doing touch myFile.swift myFile2.swift myFile3.swift and then you can add whatever you want in it by doing echo "some text" > myFile.swift. You can also append some text in it by doing echo "some text" >> myFile.swift

YoanGJ
  • 479
  • 5
  • 25