/ELFoundation

(DEPRECATED) A Swift framework that provides a base layer of functionality for Electrode-iOS modules and applications such as helper extensions, utility classes, and other generic constructs

Primary LanguageSwiftMIT LicenseMIT

ELFoundation

Build Status Carthage Compatible

ELFoundation is a collection of Swift utilities for iOS development.

Requirements

ELFoundation requires Swift 5 and Xcode 10.2.

Installation

Carthage

Install with Carthage by adding the framework to your project's Cartfile.

github "Electrode-iOS/ELFoundation"

Manual

Install by adding ELFoundation.xcodeproj to your project and configuring your target to link ELFoundation.framework from ELFoundation target.

There are two target that builds ELFoundation.framework.

  1. ELFoundation: Creates dynamically linked ELFoundation.framework.
  2. ELFoundation_static: Creates statically linked ELFoundation.framework.

Both targets build the same product (ELFoundation.framework), thus linking the same app against both ELFoundation and ELFoundation_static should be avoided.

Usage

  • exceptionFailure - A replacement for assertionFailure, usable in tests.
  • synchronized<T> - Akin to @synchronized() in Objective-C.
  • Object Association - Objective-C style object association.
  • Swizzling - Objective-C style swizzling.
  • Array (extensions) - Handy extensions.
  • NSObject (extensions) - Handy extensions.
  • NSThread (extensions) - Handy extensions.
  • NSBundle (extensions) - Handy extensions.
  • XCTestCase (extensions) - Gets XCTAssertThrows working in Swift.

Some Examples

Synchronized property access:

public var suspended: Bool {
    get {
        return lock.around {
            self.suspended
        }
    }
    
    set(value) {
        lock.around {
            self.suspended = value
        }
    }
}