Swiftpack.co - Package - FabrizioBrancati/BFKit-Swift

BFKit-Swift Banner

Build Status Coverage Status Maintainability Codebeat Badge Codacy Badge
Documentation Swift Package Manager Compatible Carthage Compatible
Version Language Platforms License


FeaturesClasses and Extensions CompatibilityRequirementsCommunicationContributingInstalling and UsageDocumentationChangelogExampleTodoAuthorLicense


Features

BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.
For example you can use every iOS font with just an enum!
It also adds some useful functions with Custom classes and extends Foundation, UIKit, AppKit and WatchKit classes.

Classes and Extensions Compatibility

BFKit

| | iOS | macOS | watchOS | Linux | |-----------------|---------|-----------|-------------|-----------| | BFApp | ✓ | ✓ | ✓ | ✓ | | BFBiometric | ✓ | | | | | BFButton | ✓ | | | | | BFDataStructures
(List - Queue - Stack) | ✓ | ✓ | ✓ | ✓ | | BFLog | ✓ | ✓ | ✓ | ✓ | | BFPassword | ✓ | ✓ | ✓ | ✓ | | BFSystemSound | ✓ | | | | | BFTextField | ✓ | | | | | BFTouchID | ✓ | | |   |

Foundation

| | iOS | macOS | watchOS | Linux | |-----------------|---------|-----------|-------------|-----------| | Array | ✓ | ✓ | ✓ | ✓ | | Collection | ✓ | ✓ | ✓ | ✓ | | Data | ✓ | ✓ | ✓ | ✓ | | Date | ✓ | ✓ | ✓ | ✓ | | FileManager | ✓ | ✓ | ✓ | ✓ | | Number | ✓ | ✓ | ✓ | ✓ | | NSObject | ✓ | ✓ | ✓ | ✓ | | NSAttributedString | ✓ | ✓ | ✓ | | | NSPointerArray | ✓ | ✓ | ✓ | | | ProcessInfo | ✓ | ✓ | ✓ | ✓ | | Set | ✓ | ✓ | ✓ | ✓ | | String | ✓ | ✓ | ✓ | ✓ | | Thread | ✓ | ✓ | ✓ | ✓ |

Core Graphics

| | iOS | macOS | watchOS | Linux | |-----------------|---------|-----------|-------------|-----------| | CGPoint | ✓ | ✓ | ✓ |   |

UIKit / AppKit

| | iOS | macOS | watchOS | Linux | |-----------------|---------|-----------|-------------|-----------| | UIBarButtonItem | ✓ | | | | | UIButton | ✓ | | | | | UIColor | ✓ | ✓ | ✓ | | | UIDevice | ✓ | | | | | UIFont | ✓ | | ✓ | | | UIImage | ✓ | | ✓ | | | UIImageView | ✓ | | | | | UILabel | ✓ | | | | | UINavigationBar | ✓ | | | | | UIPasteboard | ✓ | | | | | UIScreen | ✓ | | | | | UIScrollView | ✓ | | | | | UITableView | ✓ | | | | | UITextField | ✓ | | | | | UITextView | ✓ | | | | | UIToolbar | ✓ | | | | | UIView | ✓ | | | | | UIViewController | ✓ | | | | | UIWindow | ✓ | | |   |

WebKit

| | iOS | macOS | watchOS | Linux | |-----------------|---------|-----------|-------------|-----------| | UIWebView | ✓ | ✓ | |   |

WatchKit

| | iOS | macOS | watchOS | Linux | |-----------------|---------|-----------|-------------|-----------| | WKInterfaceController | | | ✓ |   |

Requirements

| Swift | Xcode | BFKit-Swift | iOS | macOS | watchOS | Linux | |-----------|-------------|-----------------|----------|------------|-------------|-----------| | 1.2 | 6.3 | 1.0.0...1.4.1 | 7.0+ | | | | | 2.0...2.1 | 7.0 | 1.5.0...1.6.2 | 7.0+ | | | | | 2.2 | 7.3 | 1.6.3...1.7.0 | 7.0+ | | | | | 2.3 | 8.0 | 1.8.0 | 7.0+ | | | | | 3.0...3.1 | 8.0...8.3 | 2.0.0...2.3.0 | 8.0+ | | | ✓ | | 3.0...3.1 | 8.0...8.3 | 2.4.0...2.5.0 | 8.0+ | | 2.0+ | ✓ | | 3.0...3.2 | 8.0...9.0 | 2.6.0 | 8.0+ | 10.10+ | 2.0+ | ✓ | | 4.0 | 9.0...9.2 | 3.0.0...3.1.1 | 8.0+ * | 10.10+ * | 3.0+ * | ✓ | | 4.1 | 9.3...9.4 | 3.1.2...3.2.1 | 8.0+ * | 10.10+ * | 3.0+ * | ✓ | | 4.2 | 10.0 | 4.0.0...4.1.0 | 8.0+ * | 10.10+ * | 3.0+ * | ✓ | | 5.0 | 10.2...10.3 | 5.0.0 | 8.0+ * | 10.10+ * | 3.0+ * | ✓ | | 5.1 | 11.2 | 6.0.0...6.0.1 | 8.0+ * | 10.10+ * | 3.0+ * | ✓ |

* With App Extension Support

Communication

  • If you need help, open an issue
  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, see Contributing section.

Contributing

See CONTRIBUTING.md file.

Installing and Usage

See Requirements section to check Swift, Xcode, BFKit-Swift and OS versions.

Manual

  • Open and build the framework from the project (BFKit.xcodeproj)
  • Import BFKit.framework into your project
  • Import the framework with import BFKit
  • Enjoy!

CocoaPods

  • Create a Podfile in your project directory and write into:

    platform :ios, '8.0'
    xcodeproj 'Project.xcodeproj'
    use_frameworks!
    
    pod 'BFKit-Swift'
    
  • Change "Project" with your real project name

  • Open Terminal, go to your project directory and type: pod install

  • Import the framework with import BFKit

  • Enjoy!

Carthage

  • Create a Cartfile in your project directory and write into:

    github "FabrizioBrancati/BFKit-Swift"
    
  • Open Terminal, go to project directory and type: carthage update

  • Include the created Framework in your project

  • Add Build Phase with the following contents:

    /usr/local/bin/carthage copy-frameworks
    

    Add the paths to the BFKit-Swift framework under Input Files

    $(SRCROOT)/Carthage/Build/iOS/BFKit.framework
    

    Add the paths to the copied frameworks to the Output Files

    $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/BFKit.framework
    

    This script works around an App Store submission bug triggered by universal binaries and ensures that necessary bitcode-related files are copied when archiving

  • (Optional) Add Build Phase with the following contents

    /usr/local/bin/carthage outdated --xcode-warnings
    

    To automatically warn you when one of your dependencies is out of date

  • Import the framework with import BFKit

  • Enjoy!

Swift Package Manager

  • Create a Package.swift file in your project directory and write into:

    // swift-tools-version:5.1
    import PackageDescription
    
    let package = Package(
        name: "Project",
        products: [
            .executable(name: "Project", targets: ["Project"])
        ],
        dependencies: [
            .package(url: "https://github.com/FabrizioBrancati/BFKit-Swift.git", .upToNextMajor(from: "4.0.0"))
        ],
        targets: [
            .target(name: "Project", dependencies: ["BFKit"])
        ]
    )
    
  • Change "Project" with your real project name

  • Open Terminal, go to project directory and type: swift build

  • Import the framework with import BFKit

  • Enjoy!

Documentation

Documentation

Jazzy generated documentation - 100% Documented

Changelog

To see what has changed in recent versions of BFKit-Swift, see the CHANGELOG.md file.

Example

Open and run the BFKitExample project in Example folder in this repo with Xcode and see BFKit-Swift in action!

Todo

  • ☐ Add tvOS support
  • ☐ Create a new Example App that shows all the functionalities of BFKit-Swift
  • ☐ ~100% of code coverage with Unit Tests
  • ☐ Improve code to get an A from codebeat
  • ☑ Add macOS support
  • ☑ Add watchOS support
  • ☑ Create Unit Tests and add Codecov badge
  • ☑ Add Linux support (Foundation extensions only)
  • ☑ Add Carthage support
  • ☑ Add to CocoaPods
  • ☑ Create a great documentation

Author

Fabrizio Brancati

Website: https://www.fabriziobrancati.com
Email: fabrizio.brancati@gmail.com

License

BFKit-Swift is available under the MIT license. See the LICENSE file for more info.

Github

link
Stars: 888

Dependencies

Used By

Total: 0

Releases

Fixing Pod - 2019-10-20 17:39:08

BFKit-Swift 6.0.1

20 Oct 2019

Fixed

  • Fixed swift_version in podspec file

Swift 5.1 Support - 2019-10-20 17:29:46

BFKit-Swift 6.0.0

20 Oct 2019

Added

  • Added support to Xcode 11.1 and Swift 5.1
  • Added support to WKWebView #44
  • Added iPhone 11, 11 Pro and 11 Pro Max in UIDevice extension

Deprecated

  • Deprecated FontName and FamilyFontName in UIFont extension

Removed

  • Removed support to UIWebView #44
  • Removed isURLValid on Linux

Improved

  • Updated SwiftLint to 0.35.0

Thanks to @Tripwire999 for this release

Swift 5.0 Support - 2019-04-23 21:25:37

BFKit-Swift 5.0.0

23 Apr 2019

Added

  • Added support to Xcode 10.2 and Swift 5.0

Changed

  • Renamed countSymbols() to countPunctuations() in String extension, the old one has been deprecated but still valid
  • Changed parameter type and return type of degreesToRadians(_:) and radiansToDegrees(_:) from Float to Double in Number extension
  • Changed parameter type of rotate(radians:) and rotate(degrees:) from Float to Double in UIImage extension
  • Changed search(_:) function in List struct that now returns Int instead of Int? by returning -1 instead of nil if the Element is not found
  • Changed BFLog messages from emojis to [ERROR], [WARNING], [DEBUG] and [INFO]

Improved

  • Improved count* chars functions in String extension
  • Improved build performance
  • Updated SwiftLint to 0.31.0

Removed

  • Removed all the deprecated functions and variables

Spend That Money - 2019-02-03 20:01:38

BFKit-Swift 4.1.0

03 Feb 2019

Added

  • Added iPhone XS, iPhone XS Max and iPhone XR in UIDevice extension
  • Added isFromTestFlight function in BFApp enum to check if the app has been installed from TestFlight

Thanks to @gennick for this release

Release It Please - 2019-02-03 20:00:47

BFKit-Swift 4.0.1

27 Dec 2018

Added

  • Added new iPad Pro 11-inch and 12.9-inch in UIDevice extension
  • Added missing CoreGraphics files to CocoaPods

Improved

  • Improved settings reading and saving in FileManager extension
  • Updated SwiftLint to 0.29.2

Removed

  • Removed watchOS 2.0 support in favor of watchOS 3.0, thanks to an App Store submission bug #11

Swift 4.2 Support - 2018-10-10 22:55:33

BFKit-Swift 4.0.0

11 Oct 2018

Added

  • Added support to Xcode 10 and Swift 4.2
  • Added localized and numberValue variables in String extension
  • Added queryStringParameter(parameter:), queryDictionary() and urlValid() functions in String extension

Changed

  • BFTouchID is deprecated and will be removed in a future version of BFKit-Swift. Please use BFBiometrics enum instead
  • lightFont in UIFont extension is deprecated and will be removed in a future version of BFKit-Swift
  • regularFont in UIFont extension is deprecated and will be removed in a future version of BFKit-Swift
  • boldFont in UIFont extension is deprecated and will be removed in a future version of BFKit-Swift
  • All random functions in Number extension are deprecated and will be removed in a future version of BFKit-Swift
  • Changed from Codecov to Coveralls service for code coverage

Improved

  • Updated package tools version to 4.2

Fixed

  • Now .applicationSupport case available in PathType enum in FileManager extension fully works, even if Application Support folder doesn't exist

That Corner Radius - 2018-09-13 23:12:02

BFKit-Swift 3.2.1

14 Sep 2018

Improved

  • Updated SwiftLint to 0.27.0

Fixed

  • Fixed wrong corner radius in cornerRadius(corners:, radius:) function in UIView extension

Big Improvements - 2018-07-14 13:56:25

BFKit-Swift 3.2.0

14 Jul 2018

Added

  • Added force attribute to generateUniqueIdentifier(save: Bool = default, force: Bool = default) in UIDevice extension with a default value, hence no changes are required
  • Added resetFirstStart(version: String = default) in BFApp struct, to reset the App like has never been opened
  • Added FileManager extension to Linux

Improved

  • Improved code of a lot of classes / structs and enums
  • Updated SwiftLint to 0.26.0
  • Use of canImport() instead of os()
  • Converted static only structs to enums to avoid initialization
  • Removed all force unwrapping to avoid possible crashes
  • Fixing some memory leaks

Deprecated

  • BFTouchID struct in favour of BFBiometrics enum
  • lightFont, mediumFont and boldFont from UIFont extension
  • length in favour of count in String extension

Removed

  • Removed Hound CI

Swift 4.1 Support - 2018-04-01 22:02:14

BFKit-Swift 3.1.2

2 Apr 2018

Added

  • Added support to Xcode 9.3 and Swift 4.1

Some Improvements - 2018-02-18 21:01:38

BFKit-Swift 3.1.1

18 Feb 2017

Added

  • Added swift_version property in podspec file for CocoaPods 1.4.0
  • Added Hound CI

Improved

  • Now cornerRadius(corners:, radius:) function in UIView extension uses maskedCorners for iOS 11 or above
  • fadeDuration in BFButton class is now a TimeInterval
  • Updated device names based on The iPhone Wiki
  • Updated SwiftLint to 0.25.0

Fixed

  • Now Swift Package Manager correctly builds BFKit-Swift with Swift 4

Face ID Support - 2017-12-26 17:42:50

BFKit-Swift 3.1.0

26 Dec 2017

Added

  • Added BFBiometrics struct to help handling Face ID and / or Touch ID
  • Added two new custom operators on Number extension: <> and <=> to check if a number is included in a tuple of values
  • Added isUUID(), isUUIDForAPNS() and replacingMatches(regex:, with:) to Linux in String extension

Improved

  • Improved compilation time in blur() function in UIImage extension
  • Improved debug and release code execution on BFApp struct
  • Changed generateUniqueIdentifier() to generateUniqueIdentifier(save: Bool = default) in UIDevice extension to be able to keep the generated identifier across multiple sessions, defaults to false so no changes are required
  • Updated SwiftLint to 0.24.0
  • Updated README.md to latest Carthage changes

Thanks to @tomasz-czyzak for this release

Swift 4 Support - 2017-09-23 13:37:50

BFKit-Swift 3.0.0

23 Sep 2017

Added

  • Added support to Swift 4 and Xcode 9
  • Added support to App Extensions
  • Added setTabBarVisible(_:, animated:, duration:) and isTabBarVisible in UIViewController extension

Improved

  • Updated SwiftLint to 0.22.0
  • Now gradient(colors:, direction:) returns a CAGradientLayer as a @discardableResult, so no changes are required

Fixed

  • Fixed a bug on substring(to:) function on String extension #32
  • Fixed non designable UIViews

Changed

  • Changed UIViewLinearGradientDirection to UIViewGradientDirection enum name and properties in UIView extension. Easy transition, rename only
  • Changed smoothLinearGradient(colors:, direction:) to smoothGradient(colors:, direction:, type: = default) to allow radial gradients in UIView extension. Easy transition, thanks to default value
  • Removed appDelegate global variable
  • Changed reversed(preserveFormat: = default) to eversed(preserveFormat:) in String extension because is used instead of reversed() original String function

Thanks to @wdcurry for this release

macOS Support - 2017-07-26 07:27:20

BFKit-Swift 2.6.0

26 Jul 2017

Added

  • Added macOS Support
  • Added dateSeparator and timeSeparator to init?(date:, time:) with a default value, so no changes are required
  • Added flatten<T>(_ array:) generic global function in Array extension

Improved

  • Removed Apple Watch device from UIDevice extension (Can't be used)
  • Removed support for iOS 7 in UIImage extension (Refuse)
  • Improved BFPassword struct
  • Improved tests

Fixed

  • Fixed missing style in init(frame:, style:, cellSeparatorStyle:, separatorInset:, dataSource:, delegate:) in UITableView extension
  • Fixed animate(path:, count: = default, duration:, autoreverses: = default) autoreverses
  • Fixed BFButton with a default fadeDuration value
  • Fixed wrong default duration in fade(label:, duration:, toAttributedString:) in WKInterfaceController extension

Better Gradients And Dates - 2017-07-04 15:24:29

BFKit-Swift 2.5.0

4 Jul 2017

Added

  • Added init?(iso8601:) and iso8601() functions to create a Date from an ISO 8601 String and vice-versa in Date & String extensions
  • Added new functions in NSAttributedString extension to handle left, right, center and justified text alignment
  • Added smoothLinearGradient(colors:, direction:) function in UIView extension that uses CGGradient instead of CAGradientLayer
  • Added iPad Pro 12.9 2nd Generation and iPad Pro 10.5 devices in UIDevice extension
  • Added fade(label:, duration: = default, toString:) and fade(label:, duration: = default, toAttributedString:) animation functions in WKInterfaceController extension
  • Added Set struct extension
  • Added append(_ value:, key:) function in Dictionary extension
  • Added init?(view:) function in UIImage extension

Improved

  • Now dateString(format: = default) in Date extension has a new locale parameter with a default value, so no changes are required
  • Now init?(parse dateString:, format: = default) in Date extension has a new locale parameter with a default value, so no changes are required
  • Updated SwiftLint to 0.20.0

Fixed

  • Fixed a bug where you cannot concatenate multiple attributed strings

Swift Package Manager Returns - 2017-05-31 22:56:18

BFKit-Swift 2.4.1

1 Jun 2017

Fixed

  • Fixed Swift Package Manager build on macOS

watchOS Support - 2017-05-31 08:48:04

BFKit-Swift 2.4.0

31 May 2017

Added

  • Added watchOS support (For specific classes, structs and extensions support refer to compatibility table)
  • Added WKInterfaceController class extension for watchOS
  • Added NSAttributedString class extension
  • Added NSPointerArray class extension
  • Added isNotEmpty in Array extension
  • Added saveLog(in:, filename:) in BFLog struct to save log in a file

Improved

  • Changed Travis CI builds
  • Use of randomInt() in UIColor and Array extensions
  • Removed Glibc library for Linux
  • Updated SwiftLint to 0.19.0

Minor (Breaking) Changes - 2017-04-23 15:54:11

BFKit-Swift 2.3.0

23 Apr 2017

Added

  • Added dateString(format:) in Date extension
  • Added replacingOccurrences(of:, with:) in String extension

Improved

  • Changing Sound and Font enums to be more Swifty (Xcode hints will help)
  • Updated with Swift 3.1 compatibility
  • Updated SwiftLint to 0.18.1
  • Improved tests
  • mainBundlePath in FileManager extension will now return the main bundle path if no file is specified #27

Fixed

  • Fixed an issue with randomInt() function in Number extension #26

Thanks to @on123 & @jiongge for this release

Swift 3.1 Ready - 2017-03-12 22:21:28

BFKit-Swift 2.2.2

12 Mar 2017

Improved

  • Minor changes to be Swift 3.1 ready

Better Log - 2017-01-09 23:04:54

BFKit-Swift 2.2.1

10 Jan 2017

Fixed

  • Fixed a bug in warning, error, debug and info functions in BFLog struct

Thanks to @ianrahman for this release

Cryptographically First - 2017-01-09 00:59:26

BFKit-Swift 2.2.0

9 Jan 2017

Added

  • Added new cryptographically secure random numbers generator with random() function in Number extension
    • Available to all Integer types, Float and Double
  • Added warning, error, debug and info functions in BFLog extension
  • Added has(_:, caseSensitive:) as alias of range(of:, caseSensitive:) in String extension

Improved

  • Increased code coverage
  • General enhancements in pasteboard functions
  • Enhancements in init(barButtonSpaceType:, width:) in UIBarButtonItem extension
  • Changed the implementation of randomInt() and randomFloat() function in Number extension
  • Updated SwiftLint to 0.15.0
  • Minor enhancements

Fixed

  • Fixed a bug in reversed(preserveFormat:) function in String extension

Napalm Explosion - 2016-12-23 13:27:07

BFKit-Swift 2.1.0

23 Dec 2016

Added

  • Added random() function in Array extension
  • Added array variable to String, Int, Float and Double extensions
  • Added present(title:, message:, actions:, alertType:) in UIViewController extension
  • Added support for Xcode 8.2 and Swift 3.0.2

Improved

  • Updated SwiftLint to 0.14.0

Thanks to @calebkleveter for this release

Linux Doesn't Like Emoji - 2016-12-11 19:28:59

BFKit-Swift 2.0.2

11 Dec 2016

Fixed

  • Fixed a bug for Linux on String extension

Linux Compatibility - 2016-12-10 19:49:03

BFKit-Swift 2.0.1

10 Dec 2016

Fixed

  • Fixed a bug for Linux on BFApp class

A New Beginning - 2016-12-10 18:15:59

BFKit-Swift 2.0.0

10 Dec 2016

Added

  • This version has been completely rewritten and is not compatible with 1.x versions
  • Added Swift 3.0 support
  • Added Unit Tests
  • Adopt the new API Design Guidelines
  • Use of SwiftLint
  • Builds on Linux (Foundation extensions only)
  • Added isLowPowerModeEnabled(), lowPowerModeChanged(_:), isJailbroken(), uptime and uptimeDate functions in UIDevice extension
  • Added shuffle() and shuffled() functions in Array extension
  • Added localize(), isAnagram(), isPalindrome(), links(), dates(), hashtags(), mentions() functions and ??? operator in String extension
  • Added animate(path:, count:, duration:) function in UIView extension
  • Added init(base64:) function in UIImage extension
  • Added UIViewController extension
  • Added ProcessInfo extension

Improved

  • Better handling of !, ? and throws on all sources
  • Minor enhancements & bug fix

Thanks to @the0neyouseek for this release

BFKit-Swift 1.8.0 - 2016-09-11 16:16:04

1.8.0

Added

  • Added Swift 2.3 support
  • Added Application info in BFApp class #17

Improved

  • Simplified color usage in UIColor extension #16

Fixed

  • Fixed crashes on imageToGrayscale() and imageToBlackAndWhite() in UIImage extension #15
  • Fixed countUppercaseLetters function in BFPassword class #14

Thanks to @sairamkotha, @ttyh061 & @astrokin for this release

BFKit-Swift 1.7.0 - 2016-07-14 07:45:20

1.7.0

Added

  • Added debugBlock and NSLocalizedString(key:) in global scope
  • Added BFView as subclass of UIView
  • Added < and > to compare two NSDate
  • Added hexString() and alpha() to UIColor extension
  • Added cornerRadius(corners:, radius:) to UIView extension

Improved

Fixed

  • Fixed a bug with Carthage

Thanks to @gabrielPeart for this release

BFKit-Swift 1.6.3 - 2016-05-15 16:18:45

1.6.3

Fixed

  • Fixed crash on BFDateInformation struct initializer

BFKit-Swift 1.6.2 - 2016-05-08 15:52:25

1.6.2

Added

  • Added missing devices
  • Added Swedish translation #11 & #12

Improved

  • Minor enhancements & bug fix

Thanks to @pontus-andersson for this release

BFKit-Swift 1.6.1 - 2016-03-25 00:09:26

1.6.1

Added

  • Added Package.swift file to add support to Swift Package Manager
  • Added support to Swift 2.2 and Xcode 7.3 #10

Thanks to @lucasmpaim for this release

BFKit-Swift 1.6.0 - 2016-02-01 00:27:36

1.6.0

Added

  • Added CONTRIBUTING.md file
  • Added brightness directly to UIScreen extension
  • Added randomInt() function with range support in NSNumber extension
  • Added Brazilian Portuguese #20 & #22
  • Added a screen size structure in UIScreen extension to check the device's screen size #9
  • Added NSData extension
  • Added shortDate() function to NSDate extension
  • Added safeObjectForKey() in NSDictionary extension
  • Added BFTextField subclass of UITextField to limit the max characters
  • Added some functions to NSString & String extensions
  • Added updateUniqueIdentifier(_: _:) in UIDevice extension
  • Added removeAllSubviews() in UIView extension
  • Added calculatedHeight() & setFont(_, fromIndex:, toIndex:)

Improved

  • Minor enhancements & bug fix

Fixed

  • Fixed a bug in randomColor(_) that may cause a crash #8

Thanks to @Ewg777, @emersonbroga & @liushixiang for this release