An app designed to help developers with their networking sessions
SwiftyCall-Example
An app to demonstrate how SwiftyCall
works. SwifyCall
is designed to help developers with their networking sessions.
Installation
Clone this repo and open using Xcode. Build and run on any iOS/iPad simulator. The code for this project holds the atmost importance.
Usage
The app shows dev jokes from Jokes API https://backend-omega-seven.vercel.app/api/getjoke to fetch new jokes. The app also has a more button which fetches a new joke everytime pressed. The code of this project demonstrates the ease of networking and API calling SwiftyCall. The user needs to provide the API link and the type of JSON expected.
Code
NetworkingManager.shared.fetch("https://backend-omega-seven.vercel.app/api/getjoke", type: [Joke].self) { res in
switch res {
case .success(let data):
// print(data[0].question)
// print(data[0].punchline)
self.question = data[0].question
self.punchline = data[0].punchline
case .failure(let error):
print(error)
}
}
You need to install SwiftyCall as a package/Dependency using the Swift Package Manager from the Package Link
After successfully installing the package using SPM, simply import it in your swift file like any other package or first party framework.
import SwiftUI
import SwiftyCall
License
SwiftyCall is released under the MIT license. See LICENSE for details.