Thursday, 15 August 2013

xcode - Can I import my project code into the Swift REPL? -



xcode - Can I import my project code into the Swift REPL? -

the swift repl great, improve if import classes xcode project. tried switching project directory , running

$ swift > import projectname

but got:

error: no such module 'projectname'

is possible this?

the swift repl includes number of different options. utilize swift -help see them. case, if you've defined projectname framework target , in target you've declared 'defines module' can access with:

$ swift -f <install path subdirectory projectname.framework> > import projectname

here example:

$ swift -f /users/.../library/developer/xcode/deriveddata/opus-bsjennhdtvmqrhejuabovdyxlqte/build/products/debug/ welcome swift! type :help assistance. 1> import opusosx 2> version // var framework $r0: string = "opus 1.0" 3> any([1,3]) { 0 == $0 % 2 } // 'any()' in framework $r1: bool = false 4> any([1,2,3]) { 0 == $0 % 2 } $r2: bool = true 4> any([1,2,3,4], conjoin ({ 0 == $0 % 2 }, { $0 >= 3 })) $r3: bool = true

xcode swift swift-playground

No comments:

Post a Comment