XCJumpToTests icon indicating copy to clipboard operation
XCJumpToTests copied to clipboard

Generate file if missing?

Open benron opened this issue 8 years ago • 2 comments

Hi, wondering if it would be hard or if you've considered adding functionality so that if no associated test file or spec was found, it'd create it for you? Like if I try to switch to the test file for FooBar.swift but it doesn't exist, it'll create the empty FooBarTests.swift test file.

benron avatar Dec 18 '17 21:12 benron

Thanks, it is a pretty great idea! To introduce the feature, there are some issues...

  • which directory to create FoobarTests.swift
    • with selection dialog?
  • how to import the file to Xcode
    • there is no standard api for!
    • second best way should be using https://github.com/CocoaPods/Xcodeproj

Both they are technical challenge for me. I will look into it in a month!

takasek avatar Dec 21 '17 01:12 takasek

how to import the file to Xcode

xcode-project-manager/xcodeproj has a nice and simple API for that purpose.

https://github.com/xcode-project-manager/xcodeproj/blob/0c6ac2c4c5ada36639cf2f3748c904ee757377d0/Sources/xcodeproj/PBXGroup.swift#L139

Maybe I will add that feature to https://github.com/toshi0383/hackscode . Let's see..

toshi0383 avatar Jul 11 '18 01:07 toshi0383