3

I have a Swift script "main.swift" that I created by adding

#!/usr/bin/env xcrun swift

to the start. Moreover, I chmod+x'd it to make it executable.

Within that script I would like to use a Swift class "A" defined in an other file "A.swift" contained in the same parent folder of "main.swift".

Simply using "A" within "main.swift" does not work.

Any ideas on how to achieve this?

Mandelbrot
  • 33
  • 2

1 Answers1

0

This post asked a similar question, the solution there was to concatenate the files with a shell script:

TMPFILE=`mktemp /tmp/Project.swift.XXXXXX` || exit 1
trap "rm -f $TMPFILE" EXIT 
cat *.swift > $TMPFILE
swift $TMPFILE

I haven't tested it though, so no idea if it works.

Community
  • 1
  • 1
Bulwinkel
  • 2,111
  • 25
  • 23