Latest | 1.0.0 |
---|---|
Homepage | https://github.com/Davidde94/SwiftJokes |
License | MIT |
Platforms | ios 12.0 |
Authors |
Summary
SwiftJokes is a simple framework that can be used to asynchronously load jokes to inject a little hilarity into your projects.
Installation
The only officially-supported method of installation is via Cocoapods.
- Make sure Cocoapods is installed:
sudo gem install cocoapods
- Create a podfile and add the following:
pod 'SwiftJokes', '~> 1.0.0'
- Install and enjoy:
pod install || pod install --repo-update
Side note, step 3 looks a little complicated. If pod install
fails, it’s likely because your local pods repo needs to bee updated, so the command takes care of that for you.
Usage
Always make sure to import SwiftJokes
in whichever files you’d like to provide some witty greatness.
Created a SwiftJokes object
I recommend you use the shared
object via SwiftJokes.shared
, although it’s possible to create your own instance.
Loading a joke
Jokes are loaded one at a time, and so an active internet is required. In the future I’ll work on caching jokes, but for now I’m quite lazy and can’t be bothered.
SwiftJokes.shared.loadJoke { result in
switch result {
case .success(let joke):
// do something with joke.text here
case .failure(let error):
// either ignore or handle the error
}
}
Feedback
All feedback, PRs, and issues are welcome. Feel free to either post on Github, or send something over to my email: [email protected]
Latest podspec
{ "name": "SwiftJokes", "version": "1.0.0", "summary": "An easy-to-use and hilarious joke provider.", "description": "A simple Cocoa Touch framework to asynchronously provide jokes from various sources.", "homepage": "https://github.com/Davidde94/SwiftJokes", "license": "MIT", "authors": { "David Evans": "[email protected]" }, "platforms": { "ios": "12.0" }, "swift_versions": "5", "source": { "git": "https://github.com/Davidde94/SwiftJokes.git", "tag": "1.0.0" }, "source_files": "SwiftJokes/**/*.{swift}", "swift_version": "5" }
Mon, 27 May 2019 10:09:08 +0000