# SwiftPM and Library Unit Testing

**URL:** <https://forums.swift.org/t/swiftpm-and-library-unit-testing/26255>\
**Category:** Using Swift\
**Tags:** packagemanager\
**Created:** [June 24, 2019, 6:21pm UTC](https://forums.swift.org/t/swiftpm-and-library-unit-testing/26255 "2019-06-24T18:21:56Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![SDGGiesbrecht](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sdggiesbrecht/32/4768_2.png) [@SDGGiesbrecht](https://forums.swift.org/u/SDGGiesbrecht)\
**Post date:** [July 9, 2019, 6:59pm UTC](https://forums.swift.org/t/swiftpm-and-library-unit-testing/26255/5 "2019-07-09T18:59:50Z")

</div>

> [@paulb777](#):
>
> Is there a way to test on iOS targets using `swift test` and/or `swift package generate-xcodeproj` ?

Yes. See here:

> [@Use SwiftPM to build iOS target](https://forums.swift.org/t/use-spm-to-build-ios-target/25436/10):
>
> Latching onto the “library” keyword, and assuming a transient Xcode project file is allowed, that has already been possible for quite some time: swift package generate-xcodeproj xcodebuild build -sdk iphoneos -scheme 'MyPackage-Package' xcodebuild test -destination 'name=iPhone 8' -scheme 'MyPackage-Package' (but replace “MyPackage” with the actual package name declared in the manifest.)

Those instructions are for Xcode 10. I think Xcode 11 can infer more of the arguments on its own now, but I cannot remember which off the top of my head.

---

_[View the full topic](https://forums.swift.org/t/swiftpm-and-library-unit-testing/26255)._
