GitXplorerGitXplorer
r

Asterism

public
226 stars
12 forks
8 issues

Commits

List of commits on branch master.
Verified
19cd89149257c7e7039946f6d3a91d592affa161

Create FUNDING.yml

rrobb committed 3 years ago
Verified
627604f2e2029473abeefb6334a10d449486f91c

Delete .travis.yml

rrobb committed 3 years ago
Verified
77438c2513710419c810fe93affe84f097334c1f

Merge pull request #62 from monkeydom/dom/reduce-dictionary

rrobb committed 3 years ago
Unverified
8b951184930d46abaad6265d5446aa81bfcf425d

Merge remote-tracking branch 'robb/master' into dom/reduce-dictionary

mmonkeydom committed 3 years ago
Unverified
d999927957498ced18878b96a83ed140bbc47ae6

Addressed code review concerns.

mmonkeydom committed 3 years ago
Verified
71196063c629b46cabbbd66ffe3f18a961b935da

Merge pull request #63 from robb/pr-tests

rrobb committed 3 years ago

README

The README file for this repository.

Asterism ⁂

Asterism is yet another functional toolbelt for Objective-C. It tries to be typesafe and simple.

Using common higher-order functions such as map, reduce and filter, Asterism allows you to manipulate Foundation's data structures with ease.

It makes use of overloaded C-Functions to keep its interface simple while maintaining compile-time safety. For instance, ASTEach takes different blocks depending on the data structure it operates on:

ASTEach(@[ @"a", @"b", @"c" ], ^(NSString *letter) {
    NSLog(@"%@", letter);
}];

ASTEach(@[ @"a", @"b", @"c" ], ^(NSString *letter, NSUInteger index) {
    NSLog(@"%u: %@", index, letter);
}];

ASTEach(@{ @"foo": @"bar" }, ^(NSString *key, NSString *value) {
    NSLog(@"%@: %@", key, value);
}];

This page provides extensive documentation on all of Asterism's methods.

Asterism was written by Robert Böhnke and is MIT licensed.

==============================

Getting Started

Using Carthage

Install Carthage if you don't have it. The easiest way is to use HomeBrew: brew update brew install carthage (or if you already have it installed) brew upgrade carthage

Create a Cartfile at the root directory of your project and add the following to its contents...

github 'robb/Asterism'

Run Carthage...

carthage update
If you're building for OS X

On your application targets’ “General” settings tab, in the “Embedded Binaries” section, drag and drop the Asterism.framework from the Carthage/Build/Mac folder.

Additionally, you'll need to copy debug symbols for debugging and crash reporting on OS X.

  1. On your application target’s “Build Phases” settings tab, click the “+” icon and choose “New Copy Files Phase”.
  2. Click the “Destination” drop-down menu and select “Products Directory”.
  3. Now drag and drop the Asterism.framework's corresponding dSYM file.
If you're building for iOS

On your application targets’ “General” settings tab, in the “Linked Frameworks and Libraries” section, drag and drop the Asterism.framework from the Carthage/Build/iOS folder.

On your application targets’ “Build Phases” settings tab, click the “+” icon and choose “New Run Script Phase”. Create a Run Script in which you specify your shell (ex: bin/sh), add the following contents to the script area below the shell:

/usr/local/bin/carthage copy-frameworks

and add the path to the Asterism.framework under “Input Files”, e.g.:

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

For a more detailed background of this script and it's intent, see the Carthage readme.

Using CocoaPods

First, update CocoaPods if you haven't in a while.

Then, add Asterism to your Podfile. Be sure to include use_frameworks!:

# Podfile

use_frameworks!

target 'My-OSX-App' do
    platform :osx, '10.9'
    
    pod 'Asterism'
end

target 'My-iOS-App' do
    platform :iOS, '9.2'
    
    pod 'Asterism'
end

Finally, tell CocoaPods to download and link Asterism in your project:

pod install

Using the Amalgamation header/source file pair

Checkout this repo at the version you desire.

script/gen_amalgamation.sh

cp Amalgamation/* <PathToYourProjectSourcesHere>

And just add the .m file to the targets you desire and #import "Asterism.h" when you use it or in your .pch