[swift-evolution] Proposal Idea : Library (third party) Importable Checking
Jo Albright
me at jo2.co
Thu Jan 14 11:22:25 CST 2016
This is a thought from a current problem I am running into (and have ran into in the past).
If you want to write any code using a library, you must have that library imported into the file. Totally cool with this for most cases.
Situation :
Building a third party library that can be used by others to simplify working with server APIs. I want to give the developer an option to use another third party library within mine. However, I don’t want my library to depend on the other library.
Possible Solution :
Add a system that does two things. 1) Checks for a library and if found imports it into file. 2) Checks if library is imported and allows source kit to parse conditional scope.
@importable ThirdPartyLibrary // would check if library is added to project and import it
if #imported(ThirdPartyLibrary) {
// would check if library is imported before source kit parses scope
// if library is not imported
// scope would remain unparsed
// scope could be removed as if it were a comment
}
Thanks.
Designer . Developer . Nerd
Jo Albright
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160114/78111823/attachment.html>
More information about the swift-evolution
mailing list