Getting square objects down round holes

Related tags

Utility YOLOKit
Overview

Enough with the bazillion lines of array parsing logic. YOLO.

@import YOLOKit;

campaigns.reject(^(PPCampaign *campaign){
    return campaign.locked;
}).pluck(@"venues").flatten.each(^(PPVenue *venue){
    [geofencer startMonitoringForRegion:venue.region];
});
  • YOLOKit is completely modular, if you only want map then only have map: pod "YOLOKit/map"
  • YOLOKit is thorough, well-tested and inside apps on the store
  • Every single method in YOLOKit was carefully considered; every detail poured over. YOLOKit is not just a direct port of Ruby’s Enumerable or Underscore, it is a delightful implementation inspired by such but designed for your needs as an iOS developer.

YOLOKit is thoroughly documented at http://mxcl.github.io/YOLOKit/.

Comments
  • Idiomatic Objc method names

    Idiomatic Objc method names

    There seem to be some uneccessary rubyisms in the code, most notably method names like each_with_index which should be eachWithIndex or empty which should be isEmpty.

    There is more, but due to me typing this on an iPad, i'd rather not list them all out.

    opened by dwt 8
  • Fix rotate bug when array is not your example array

    Fix rotate bug when array is not your example array "@[@1, @2, @3, @4]".

    Hi, there is a issue of NSArray+rotate when the array.count != 6. Your test array is just a coincidence in unit test.

    id rv = @[@1, @2, @3, @4, @5, @6, @7].rotate(-2);

    if (pivot < 0) pivot = (int)self.count + pivot; // pivot = 7 - 2 = 5 return self.skip(pivot).concat(self.snip(pivot)); before fix: // self.skip(5) ===> @[@6, @7] // self.snip(5) ===> @[@1, @2] // .concat ===> @[@6, @7, @1, @2] ❌ return self.skip(pivot).concat(self.snip(self.count - pivot)); after fix: // self.skip(5) ===> @[@6, @7] // self.snip(2) ===> @[@1, @2, @3, @4, @5] // .concat ===> @[@6, @7, @1, @2, @3, @4, @5] ✅

    So grateful for your YOLOKit that helped me a lot!

    opened by wangleiTT 5
  • After installing YOLOKit with Cocoapods methods are not found

    After installing YOLOKit with Cocoapods methods are not found

    Just added YOLOKit to my project using Cocoapods and imported YOLO.h, but XCode keeps complaining that the methods can't be found:

    IGAPI.m:61:18: Property 'each' not found on object of type 'NSArray *'

    When I comment out the #ifdef YOLO_EACH in YOLO.h everything works fine. It seems like XCode is not correctly setting the pre-compiler definitions correctly.

    Any idea what's going wrong in my project? Other Pods don't seem to have these problems.

    opened by mac-cain13 5
  • Changes to be more readable, more Objective-C-like

    Changes to be more readable, more Objective-C-like

    NSDictionary values can be retrieved with [], eg. @{@1:@"1", @2:@"2"}[@2] => @"2". get() is unnecessary and less readable than [] (-objectForKeyedSubcript:), plus will be slower (extra method dispatch) and take more memory.

    opened by danhd123 5
  • v11.1 Broke array.map

    v11.1 Broke array.map

    This change is causing a crash for me since I updated to 11.1

    https://github.com/mxcl/YOLOKit/compare/11...11.1#diff-4bbdff7cda9b63e25e2e8865533250d4L31

    Error:

    method only defined for abstract class.  Define -[__NSCFArray initWithCapacity:]!
    

    When subclassing or extending NS class clusters like NSArray we need to be extra careful about what assumptions the code makes (https://mikeash.com/pyblog/friday-qa-2010-03-12-subclassing-class-clusters.html).

    This is a pretty serious issue so I'm reverting to 11.0 for now.

    opened by oztune 3
  • crash on NSArray.uniq.map

    crash on NSArray.uniq.map

    apologize for bug in previous my pull request.

    NSArray.uniq returns NSArray, but it's concrete class is some private class. And the class does not responds -initWithObjects:count:.

    opened by kkazuo 2
  • Xcode Cross-Project Reference

    Xcode Cross-Project Reference

    I was reading your README.md. To learn Follow the steps in the README.md

    The README.md at https://github.com/venmo/venmo-ios-sdk gives instructions on how to add a cross-project reference in Xcode. Follow the steps up to "ADD THE VENMO URL TYPE."

    Question for you. Do you know how I could add tagging by full name (not by username) to a UITextView?

    opened by ma11hew28 2
  • NSArray.any()

    NSArray.any()

    As a Linq fan I'm very happy with your library, thanks. What i'm missing is a items.any() method though. Update: I guess items.find() is equivalent :-)

    opened by wbison 1
  • These are some expensive blocks...

    These are some expensive blocks...

    Blocks are neither cached nor global, so every single time one of the block-returning methods is called (and then the block itself is called for execution) the following will happen:

    1. Message dispatch - objc_msgSend called. Relatively fast, particularly for cached IMPs
    2. The block is allocated on the stack. Fast.
    3. Parameters are copied for the closure. Fast, if the parameter is not a block, fast if the block passed in is already on the heap, slow otherwise.
    4. The block is copied to the heap. This is slow, both to copy the block itself and all its variables. malloc() is not fast.
    5. The block on the heap is returned. Fast.
    6. The block is invoked. Fast-ish.
    7. The block is executed. There are some issues here, but in principle, this could be fast if some of the implementations in YOLOKit were better.
    8. The block returns its result. Fast.
    9. The block and any parameter blocks copied in step 3 are released and the returned block in 5 deallocated! SLOW! free() is not fast!

    Compare to standard message sending:

    1. Message dispatch. Relatively fast.
    2. The method is executed. Could be fast.
    3. Method returns its result. Fast.

    3 potentially fast steps (with 2 pitfalls) versus 7 potentially fast steps (with 3 pitfalls), and 2 guaranteed slow steps.

    Suggested fix: hoist all the blocks returned into global scope, or cache them. This will at least eliminate the copy and free on every call, although it only reduces the number of steps to 7.

    opened by danhd123 1
  • Off by one in documentation of NSArray.indexOf

    Off by one in documentation of NSArray.indexOf

    I think there is an off-by-one error in the documentation of NSArray.indexOf.

    Shouldn't it return a zero-based index like

    uint rv = @[@1, @2, @3, @4].indexOf(@2)
    
    // rv => 1
    
    opened by felixkiss 1
  • Add a Gitter chat badge to README.markdown

    Add a Gitter chat badge to README.markdown

    mxcl/YOLOKit now has a Chat Room on Gitter

    @mxcl has just created a chat room. You can visit it here: https://gitter.im/mxcl/YOLOKit.

    This pull-request adds this badge to your README.markdown:

    Gitter

    If my aim is a little off, please let me know.

    Happy chatting.

    PS: Click here if you would prefer not to receive automatic pull-requests from Gitter in future.

    opened by gitter-badger 0
  • Update documentation at http://mxcl.github.io/YOLOKit/

    Update documentation at http://mxcl.github.io/YOLOKit/

    Not sure how the documentation at http://mxcl.github.io/YOLOKit/ was generated, but there are a bunch of new, undocumented methods for things like NSSet in the current source tree. How can I help update the main docs page?

    I noticed that there are some doc generation in a separate branch (https://github.com/mxcl/YOLOKit/tree/gh-pages) -- and reason this is not included in the main repo?

    opened by cayleyh 1
Differific is a diffing tool that helps you compare Hashable objects using the Paul Heckel's diffing algorithm

Differific is a diffing tool that helps you compare Hashable objects using the Paul Heckel's diffing algorithm. Creating a chan

Christoffer Winterkvist 127 Jun 3, 2022
Highlighter will magically find UI objects such as UILabel, UITextView, UITexTfield, UIButton

Highlighter Updates See CHANGELOG for details Intoduction ?? Highlight whatever you want! Highlighter will magically find UI objects such as UILabel,

Kyle Yi 932 Dec 12, 2022
Type-Safe Associated Objects in Swift

Type-Safe Associated Objects in Swift TSAO is an implementation of type-safe associated objects in Swift. Objective-C associated objects are useful, b

Lily Ballard 135 Dec 21, 2022
Observe objects in SwiftUI Views which may be nil

ObservedOptionalObject Rationale SwiftUIs @ObservedObject requires that the observed object actually exists. In some cases it's convenient to observe

Matthias Bartelmeß 7 Jul 20, 2022
A Swift collection of unique, ordered objects

Introduction OrderedSet is essentially the Swift equivalent of Foundation's NSOrderedSet/NSMutableOrderedSet. It was created so Swift would have a uni

Weebly 248 Sep 14, 2022
Number Pad (inspired by Square)

NumPad Number Pad inspired by Square. This module is based on LEAmountInputView. $ pod try NumPad Requirements iOS 9.0+ Xcode 9.0+ Swift 4 (NumPad 3.

Lasha Efremidze 81 Dec 29, 2022
Square In-App Payments iOS SDK SwiftUI

Square In-App Payments iOS SDK SwiftUI Build remarkable payments experiences in

Ashley Bailey 2 Mar 8, 2022
Easily add drop shadows, borders, and round corners to a UIView.

Easily add drop shadows, borders, rounded corners to a UIView. Installation CocoaPods Add the follwing to your Podfile: pod 'Shades' Usage Storyboard

Aaron Sutton 14 Jun 20, 2020
VolumeControl is a custom volume control for iPhone featuring a well-designed round slider.

#VolumeControl VolumeControl is a custom volume control for iPhone featuring a well-designed round slider. Preview Usage // Include VolumeControl.h in

12Rockets 81 Oct 11, 2022
A custom calculator for deg to rad conversion & the other way round

Lilium Features A custom calculator for deg to rad conversion & the other way round. How to use Slide up the dock and you should see Lilium. An activa

null 2 Nov 20, 2022
UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

Aaron Abentheuer 481 Jul 28, 2022
round icon drag control (made in swift) dock style

ASBubbleDrag Bubble drag control integrate in storyboard : Installation CocoaPods You can use CocoaPods to install ASBubbleDrag by adding it to your P

Alberto Scampini 46 Oct 12, 2022
A Material Design drop down for iOS

A Material Design drop down for iOS written in Swift. Demo Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods

AssistoLab 2.3k Dec 20, 2022
An app to count down the days until upcoming milestones.

Milestones An app to count down the days until upcoming milestones. We all have something to look forward to. Built to try out the Swift Composable Ar

JP Simard 196 Dec 18, 2022
An iOS drop down menu with pretty animation and easy to customize.

IGLDropDownMenu An iOS drop down menu with pretty animation. Screenshot How To Use Use CocoaPods: pod 'IGLDropDownMenu' Manual Install: Just drap the

Galvin Li 1.2k Dec 27, 2022
A Material Design drop down for iOS

A Material Design drop down for iOS written in Swift. Demo Do pod try DropDown in your console and run the project to try a demo. To install CocoaPods

AssistoLab 2.3k Jan 1, 2023
UIKit drop down menu, simple yet flexible and written in Swift

DropDownMenuKit DropDownMenuKit is a custom UIKit control to show a menu attached to the navigation bar or toolbar. The menu appears with a sliding an

Quentin Mathé 258 Dec 27, 2022
Simple and Elegant Drop down menu for iOS 🔥💥

SwiftyMenu is simple yet powerfull drop down menu component for iOS. It allow you to have drop down menu that doesn't appear over your views, which gi

Karim Ebrahem 502 Nov 29, 2022
A pull-down-to-refresh control for iOS that plays pong, originally created for the MHacks III iOS app

BOZPongRefreshControl A pull-down-to-refresh control for iOS that plays pong Installation It's on CocoaPods! Put pod 'BOZPongRefreshControl' in your P

Ben Oztalay 885 Dec 12, 2022
ChidoriMenu - An easy way to add menus visually similar to iOS 14's Pull Down and Context Menus but with some added benefits

ChidoriMenu ?? ⚡️ An easy way to add popover menus visually similar to the Conte

Christian Selig 152 Dec 12, 2022