Swiftpack.co - Package - AckeeCZ/ACKategories

ackee|ACKategories

Swift CI Status Version Carthage compatible License Platform

A bunch of tools, cocoa subclasses and extensions we created and use at Ackee.

Installation

CocoaPods

ACKategories is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ACKategories", "~> 6.7.2"

Carthage

You can also use Carthage. Specify this repo in your Cartfile:

github "AckeeCZ/ACKategories" ~> 6.7.2

SPM

Or you can use SPM. Add this to your Package.swift:

.package(url: "https://github.com/AckeeCZ/ACKategories.git", .upToNextMajor(from: "6.7.2")),

Swift versions

If you're interested in using ACKategories in your older projects see all branches, there probably is the version you need.

List of features

This is only fast description of features, see source code for documentation comments and details.

Flow coordinators

ACKategories contain basic FlowCoordinator that should be used as parent class for all your flow coordinators. For more information see FlowCoordinators.

UIButton

Extension for UIButton that fixes intrinsicContentSize and adds titleEdgeInsets to it.

UIColor

  • Initialize colors with hex codes
  • Create random color
  • Create lighter/darker colors from color
  • Recognize light/dark background colors to decide what text color you should use.
  • Create solid color image from color.

UIControl

Add action blocks to UIControls.

let button = UIButton()
button.on(.touchUpInside) { sender in
    ...
}

If running on iOS 9 or later you can use implicit parameter UIControl.primaryActionTriggered.

String

  • trim strings easily
  • get first letter of string
  • simplify localization

Collections

  • isEmpty on optional collections (even strings). Returns true when collection is nil or empty.

TableHeaderFooterView

Use this view as TableHeaderView or TableFooterView when your table/footer has dynamic content size.

GradientView

Use this view when you want to create a view with gradient colors and a given axis.

Init takes two parameters:

  • colors: The colors to be used for the gradient.
  • axis: The axis of the gradient: .vertical for bottom-to-top gradient, .horizontal for left-to-right gradient.

Please note: If one of your colors is clear, you should usually define to which "clear color" it should go to - i.e. if you want to go from white to clear, write:

let gradientView = GradientView(colors: [UIColor.white, UIColor.white.withAlphaComponent(0)], axis: .vertical)

UITableView and UICollectionView extensions

Since now you can use simple extension which autoregisters your UITableView and UICollectionView cells!

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    // generically dequed cell which was autoregistered, no need to register your cells in advance
    let cell: YourCustomCell = tableView.dequeCellForIndexPath(indexPath)
    return cell
}

And it's the same story with UICollectionView.

Forking this repository

If you use our extensions within your team we would love to hear about it. Drop us a tweet at @ackeecz or leave a star here on Github. BTW we would also like to know what other extensions you use!

Sharing is caring

This repo has been opensourced within our #sharingiscaring action when we have decided to opensource our internal projects.

Author

Ackee team

License

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

Github

link
Stars: 41

Dependencies

Used By

Total: 0

Releases

6.7.2 -

6.7.1 -

6.7.0 -

6.6.0 -

Added

  • Completion block for stop (#88, kudos to @fortmarek)
  • Run SwiftLint on build if installed locally (#87, kudos to @olejnjak)
  • Add Catalyst support to iOS target (#86, kudos to @olejnjak)
  • Add UserDefault property wrapper (#85, kudos to @fortmarek)

6.5.1 -

6.5.0 -

Added

  • Add Random extensions (#82, kudos to @fortmarek)
  • Add more arguments from NSLocalizedString to String.localized() (#80, kudos to @olejnjak)
  • Add prototype cell storage to UITableView and UICollectionView (#78, kudos to @olejnjak)

Changed

  • Deprecated safeArea extension on iOS 11+ (#79, kudos to @olejnjak)
  • Fix typos (#76, kudos to @michalsrutek)
  • Set BUILD_LIBRARY_FOR_DISTRIBUTION to YES (#75, kudos to @fortmarek)
  • Do not dismiss presentingViewController of rootViewController on Base.FlowCoordinator stop() when remaining VCs in the navigation stack (#72, kudos to @IgorRosocha)

Fixed

  • Fix changelog check (#81, kudos to @olejnjak)

-

-

Fixed

  • Fix GradientView layer frame on orientation change (#74, kudos to @fortmarek)
  • Fix generate docs action (#73, kudos to @fortmarek)
  • Fix a typo (#70, kudos to @michalsrutek)

Changed

  • Use a preferred AnyObject keyword instead of class in protocol conformance (#71, kudos to @michalsrutek)

-

Added

  • Add swift-doc action, checks actions (#67, kudos to @fortmarek)
  • add UIDevice.current.modelName extension to receive model name of current device (#66, kudos to @olejnjak)
  • add clearLaunchScreenCache() to completely clear launch screen cache (#63, kudos to @igorrosocha)

Fixed

  • Fix swiftlint violations (#69, kudos to @fortmarek)
  • Fix wrong transparency in UIColor.image() (#65, kudos to @janmisar)

Changed

  • Update tapestry structure (#68, kudos to @fortmarek)
  • separate frameworks for Swift and iOS (#64, kudos to @olejnjak)
  • use native UISearchBar.searchTextField on iOS 13+ (#61, kudos to @olejnjak)

-

  • add support for generic dequeueing for MKAnnotationViews dequeueAnnotationView(for annotation: MKAnnotation) (#60, kudos to @svastven)
  • add support for Dark Mode when creating colored images from UIColor (#59, kudos to @svastven)
  • add tapestry for automating future releases (#56, kudos to @fortmarek)
  • update FlowCoordinator to count with iOS 13 modal presentations (#55, kudos to @olejnjak)

SwiftPM support -

  • add forceIntrinsic() to UIView to set its contentHuggingPriority and contentCompressionResistance to UILayoutPriority.required (#48, kudos to @olejnjak)

  • add hexString closure into UIColorExtension that will return hex string from UIColor (#49, kudos to @majkcajk)

  • add SwiftPM manifest (#52, kudos to @olejnjak)

  • add type parameter to dequeueCell(...) methods so using it is more convenient (#53, kudos to @olejnjak)

    From now you can also use

    tableView.dequeueCell(for: indexPath, type: YourCell.self)
    

-

-

-

  • added deep link generic for Base.FlowCoordinator (#47, kudos to @fortmarek)
  • Swift 5 & Xcode 10.2 migration (#45, kudos to @janmisar)
  • base classes for VCs, VMs, FCs (#45, kudos to @janmisar)

Fixed emoji in log -

  • emoji for flow coordinator init fixed

-

  • move from NSLog to unified logging (#39, kudos to @fortmarek)
  • allow additional logic for isEmpty for collections (#40, kudos to @fortmarek)
  • add LICENSE file to Cocoapods source files

-

New

  • add GradientView (#36, kudos to @fortmarek)
  • remove date extensions (#35, kudos to @olejnjak)

Xcode 10 support -

New

  • add support for Xcode 10, build using Swift 4.2 (#34, kudos to @olejnjak)

-

New

  • add safe range subscript to Collections (#31, kudos to @olejnjak)
  • add string.removingDiacritics() (#32, kudos to @olejnjak)

Improvements

  • move safe subscript from Array to Collection (#31, kudos to @olejnjak)

This is last release that will support Xcode 9.x

-

Make start() methods on FlowCoordinator open

Flow coordinators -

  • add base FlowCoordinator class to handle flow outside the view controllers

Date formatting -

Features

  • add extensions for date formatting (#28, kudos to @janmisar)

👋 CALayer shortcuts -

Removed

  • CALayer shortcuts on UIView as they were occasionally ambigous with other libraries (kudos to @olejnjak)

5.4.0 -

Features

  • new CALayer shortcuts (#26, kudos to @janmisar)
  • new UIStackView shortcuts (#27, kudos to @olejnjak)
  • new Date extensions (#27, kudos to @olejnjak)

String and UIViewController extras -

  • add extensions to simply adding and removing childViewController on UIViewController
  • improve string.trimmed() method to receive CharacterSet and side as arguments so now you can trim different characters then just whitespaces and newlines, also you can trim just from one side

Fix conditional assignment -

Well if you tried the following code

let nilValue: Int? = nil
var property: Int? = 5
property =? nilValue

the property would be nil which just sucks. Now it just works.

5.2.0 -

5.2.0

Additions

  • add concatenation capability to NSAttributedString
  • add isEmpty property to optional collections (this has a side-effect that the same property on String is removed as String is Collection)
  • add UIButton.centerVertically(padding:) extension
  • add safeArea to UIView which can be used on all systems (on older systems it just fallbacks to appropriate edge)

Deprecations

  • String.normalizedValue() is deprecated in favor of String.normalized() and will be removed in next major release

Bunch of new stuff -

  • add safe subscript to RandomAccessCollections
  • add + function to merge two dictionaries
  • add extension for UITableView to dequeue UITableViewHeaderFooterView generically
  • add extension for UICollectionView to dequeue supplementary views generically
  • add device ID to UserDefaults (based on UUID)
  • add Array.remove(object:) for arrays of Equatable objects
  • add extensions for Bundle to access often used properties from Info.plist more conveniently
  • add extensions for TimeInterval to work with larger units (minutes, hours, etc.)

Swift 4 support -

Now we support Swift 4!

We also removed deprecated stuff

-

  • Simulation of classic valueForKeyPath on Dictionary
  • Remove nils in Dictionary
  • isEmpty on optional String returns non-optional Bool
  • NumberFormatter can return String from Int
  • Normalized String - remove accents etc.