Reputation: 1143
I am actually following a course on IOS development at my University but sadly a few interesting topics are not going to be thoroughly explained. I have two main questions on those topics.
My first question is:
My second question concerns documentation. I recently read that the code commenting process for swift in xcode 7 had changed.
I thank you in advance for any explanation, tips, tutorials, or even just a guidance to some good ressources covering these two questions.
Have a good day and best regards,
Martin
Upvotes: 1
Views: 171
Reputation: 19154
You can use OCMock or OHHTTPStubs to mock the network request. There's a lot info in the web.
Another alternative is to use a local HTTP server. For example, setting up a Sinatra server will take just a few lines of code. This is useful, when you want to test more lower level details, for example whether your query parameters get correctly composed.
The tool chain supports a certain documentation syntax for Swift source code and playgrounds. This is documented here: Markup Formatting Reference.
Here's an example how it looks like:
/**
If `self` is `Success` returns the mapping function `f` applied to the
value of `Success`. Otherwise, returns a new `Try` with the value of
`Failure`.
- parameter f: The maping function.
- returns: A `Try<U>`.
*/
public func flatMap<U>(@noescape f: T -> Try<U>) -> Try<U> {
switch self {
case .Success(let value):
return f(value)
case .Failure(let error):
return Try<U>(error: error)
}
}
Source code from a third party library documented like this will enable any user of this framework to get quick help in their code when editing with Xcode.
In order to create HTML documents (and other types of documents) for your library you can use Jazzy. Jazzy is a command line tool, which creates HTML docs directly from the sources. In your project you can setup a "build task" which creates the documentation.
If you publish your library via CocoaPods service, the documentation will be automatically created by CocoaPods service (using Jazzy for Swift and AppleDoc for Objective-C) and is available publicly. See here an example: http://cocoadocs.org/docsets/Alamofire/3.3.1/
Upvotes: 1