Retry alternatives and similar libraries
Based on the "Utility" category.
Alternatively, view Retry alternatives based on common mentions on social networks and blogs.
-
swift-algorithm-club
Algorithms and data structures in Swift, with explanations! -
SwifterSwift
A handy collection of more than 500 native Swift extensions to boost your productivity. -
libextobjc
A Cocoa library to extend the Objective-C programming language. -
InAppSettingsKit
This iOS framework allows settings to be in-app in addition to or instead of being in the Settings app. -
DifferenceKit
💻 A fast and flexible O(n) difference algorithm framework for Swift collection. -
EKAlgorithms
EKAlgorithms contains some well known CS algorithms & data structures. -
EZSwiftExtensions
:smirk: How Swift standard types and classes were supposed to work. -
Reusable
A Swift mixin for reusing views easily and in a type-safe way (UITableViewCells, UICollectionViewCells, custom UIViews, ViewControllers, Storyboards…) -
SwiftLinkPreview
It makes a preview from an URL, grabbing all the information such as title, relevant texts and images. -
WhatsNew
Showcase new features after an app update similar to Pages, Numbers and Keynote. -
BFKit-Swift
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster. -
BFKit
BFKit is a collection of useful classes and categories to develop Apps faster. -
VTAcknowledgementsViewController
Acknowledgements screen displaying a list of licenses, for example from CocoaPods dependencies. -
ReadabilityKit
Preview extractor for news, articles and full-texts in Swift -
ObjectiveKit
Swift-friendly API for a set of powerful Objective C runtime functions. -
SwiftFoundation
Cross-Platform, Protocol-Oriented Programming base library to complement the Swift Standard Library. (Pure Swift, Supports Linux) -
AssistantKit
Easy way to detect iOS device properties, OS versions and work with screen sizes. Powered by Swift. -
DeviceGuru
DeviceGuru is a simple lib (Swift) to know the exact type of the device, e.g. iPhone 6 or iPhone 6s. Please ⭐️ this repo on the top right corner to make this repo popular. -
Standard Template Protocols
Protocols for your every day iOS needs -
YAML.framework
Proper YAML support for Objective-C. Based on recommended libyaml. -
SBConstants
Generate a constants file by grabbing identifiers from storyboards in a project. -
ZamzamKit
A Swift package for rapid development using a collection of micro utility extensions for Standard Library, Foundation, and other native frameworks.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Retry or a related project?
README
Retry
Example
Haven't you wished for try
to sometimes try a little harder? Meet retry
To run the example project, clone the repo, and run pod install
from the Example directory first.
The full test suite shows a variety of use cases.
Synchronous retry
NB: The sync retry
is not good for use on the main thread (because it will block it if you're having delays, etc). For the main thread it's better considering retryAsync
(more info below).
Default parameters - retry three times without any delay:
retry {
... do some throwing work ...
}
Catching the last error, and adding a defer block after all tries have finished - will keep trying maximum 10
times. You can use either of the final blocks or both:
retry (max: 10) {
... do some throwing work ...
}
.finalCatch {lastError in
print("This simply won't happen. Failed with: \(lastError)")
}
.finalDefer {
print("Finished trying")
}
Add 2
second delay between the retries:
retry (max: 5, retryStrategy: .delay(seconds: 2.0)) {
... do some throwing work ...
}
Implement any custom delay logic (below is multiplying the waiting time after each try):
retry (max: 5, retryStrategy: .custom {count, lastDelay in return (lastDelay ?? 1.0) * 2.0} ) {
... do some throwing work ...
}
Limit the number of retries based on any custom logic - if you return nil
from your custom strategy, retry
will stop trying:
retry (max: 5, retryStrategy: .custom {count,_ in return count > 3 ? nil : 0} ) {
... do some throwing work ...
}
Asynchronous retry
The syntax for retryAsync
is exactly the same as for retry
. The difference in behavior is if the first try fails retryAsync
keeps trying asynchronously instead of blocking the current thread.
Installation
Retry is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Retry"
Retry is also available through Swift Package Manager. To install, add https://github.com/icanzilb/Retry.git
to your package manifest.
Since Retry is a swift3 library, you got to add this piece of code to your project's Podfile, to update your targets' swift language version:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.10'
end
end
end
Author
Marin Todorov, 2016-present
Inspired by the retry operator in https://github.com/RxSwiftCommunity/RxSwiftExt
License
Retry is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the Retry README section above
are relevant to that project's source code only.