Swiftpack.co - bigMOTOR/Helpers as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by bigMOTOR.
bigMOTOR/Helpers 3.1.1
Tiny convenient code pieces that I'm tired of copy-paste across all my projects.
⭐️ 2
🕓 3 weeks ago
iOS
.package(url: "https://github.com/bigMOTOR/Helpers.git", from: "3.1.1")

Helpers

Helpers Logo

Tiny convenient code pieces that I'm tired of copy-paste across all my projects.

Swift Stdlib Extensions and Common things I need sometimes (Helpers):

Array;
subscript (safe index: Int) -> Element?
func subtract(_ other: [Element]) -> [Element]
func distance(to index: Index) -> Int 
Date;
  • work with unixMilliseconds;
  • date components;
  • beginning/end of date components;
  • adding date components;
  • comparison.
UserDefaults;
  • provides getter and setter for Codable values.
Something I need sometimes;
  • protocol AppDetails - provides app version and build number;
  • protocol AppStoreReview - provides dialog for Rate Us;
  • protocol DeviceDetails - provides device model, system version and device locale;
  • protocol ErrorLocalizedDescription;
  • Formatter - easy way to format numbers;
  • JsonObject - pretty typealias for [String: Any].

Combine (HelpersCombine)

  • PublisherExtension:
func mapToVoid()
func mapToOptional()
func flatMapLatest()
func filterFalse() 
func filterTrue() 
func invert() 
func mapArray<T>(transform)
func shareReplay(bufferSize)    // Adapted from https://www.onswiftwings.com/posts/share-replay-operator/ 

In-App (HelpersIAP):

  • IAPProduct model;

RxSwift Extensions (HelpersRxSwift):

func mapToVoid()
func filterFalse()
func filterTrue()
func invert()
func asDelayedActivity(_ delay: DispatchTimeInterval = .milliseconds(200))
func mapArray<T>(transform)
func fromAsync(_ block: { element in ... }) -> Single<Element>

SwiftUI (HelpersSwiftUI):

Modifiers:

func navigationBarColors(background: Color, tint: Color)
func onFrameChange(enabled isEnabled: Bool = true, frameHandler: @escaping (CGRect)->())
func shimmer(isActive: Bool = true, speed: Double = 0.15, angle: Angle = .init(degrees: 70), opacity: Double = 1.0)
func cornerRadius(_ radius: CGFloat, corners: UIRectCorner)
func onRotate(perform action: @escaping (UIDeviceOrientation) -> Void)
func rotateHandling(anchor: UnitPoint = .center)
func rotated(_ angle: Angle)
func blink(on state: Binding<Bool>, duration: Double = 0.1)
Views
  • MailView.

The Composable Architecture (TCA) Helpers (HelpersTCA):

  • Lifecycle Reducer (problem statement);
  • Equatable VoidResult type;
  • Equatable WrappedError type.

Many thanks to Misha Markin at this part.

Rx and TCA Wrappers for RevenueCat Subscription Platform (RevenuecatRx or RevenuecatComposable)

Installation

Helpers available via:

License

Helpers is available under the MIT license. See the LICENSE file for more info.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics