SQLClient icon indicating copy to clipboard operation
SQLClient copied to clipboard

Support for Swift Package Manager

Open imarennow opened this issue 6 years ago • 3 comments

imarennow avatar Sep 10 '19 19:09 imarennow

Thanks very much! Can you provide me with instructions on how to properly test this? Also do you have any suggestions on making the code more Swift-friendly? Thanks!

martinrybak avatar Sep 24 '19 08:09 martinrybak

Sure thing! A few notes, enumerated:

  1. I noticed after making the PR that my updates to the README file didn't jive with Github's Markdown parser, which I've corrected in a new commit.
  2. I've attached two zips, which contain a sample Xcode project (you'll need the latest version of Xcode for that) and a "plain" Swift Package Manager project respectively.
    2.1. The projects only demonstrate how to reference the repo via SwiftPM and that the code compiles, since I don't have a SQL Server to connect to for demo purposes.
    2.2. The SwiftPM references are to our branch, for obvious reasons, so those demo projects will break if/when we delete our repo due to a merge.
  3. As far as increased Swift-friendliness, you've already done the biggest piece, which is nullability annotations. The only place where I see some room for improvement is:
    3.1. The declaration of -execute:completion:, which leaves the contained type of the completion parameter unspecified. If it were specified as - (void)execute:(nonnull NSString*)sql completion:(nullable void(^)(NSArray<NSArray<NSDictionary<NSString*, __kindof NSObject*>*>*>* results))completion;, then it would be imported into Swift as func execute(_ sql: String, completion: @escaping (Array<Array<Dictionary<String, AnyObject>>>)->Void), which makes accessing the results a bit easier.

Sorry for the delay.

SwiftSQL_Xcode.zip

SwiftSQL_spm.zip

imarennow avatar Oct 18 '19 16:10 imarennow

I have been using this since about a year and everything seems to be working fine. This pull request can be merged.

sree-86 avatar Apr 22 '21 19:04 sree-86