andrewsardone + objective-c   106

VerbalExpressions ♥ Open Source
Regular Expressions made easy

A handy and more approachable fluent API (that seems pretty consistent across languages) for creating a regular expression-like object for testing strings.

Swift example:

let tester = VerEx()
.anythingBut(" ")
regularexpression  regex  github_repo  swift  javascript  objective-c  java  php  development 
january 2016 by andrewsardone
Secrets of launch arguments (iOS)
<3 this simple write up to make Xcode's launch arguments at all understandable.

I intend to change out some cumbersome code intended for "feature flags" (currently uses a mix of preprocessor definitions or Swift flags) with simple launch arguments + NSProcessInfo.
feature-flag  objective-c  swift_lang  tools  xcode 
november 2015 by andrewsardone
Mapbox GL | Mapbox
Vector Mapbox maps with a drop-in MKMapView replacement. Built in C++14 using OpenGL ES 2.0, if anything this is a very interesting example of how to build cross-platform code.

Announcement blog post:
c++  objective-c  java  mapbox  cross-platform  OpenGL  javascript 
may 2015 by andrewsardone
Which features overcomplicate Swift? What should be removed?

the single greatest source of complication to Swift is Objective-C.

The rules for overriding a superclass’ init are Byzantine to the point of impossibility.

The rules for parameter labels are different for free functions, methods, parameters with default values, and curried parameters, and you will never be able to remember them correctly the first time.

The lack of guaranteed tail-call optimization complicates a lot of patterns which would be much clearer expressed recursively. You can still write these programs recursively, of course, it’s just that you’ll blow the stack for unbounded input.
swift_lang  complexity  via:iosdevweekly  technicaldebt  objective-c 
may 2015 by andrewsardone
MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.

An impressive library for mail communication, used by popular apps like Sparrow (originally) and Dispatch.

It's build-able for iOS, Mac, Android, Linux, and Windoes, so that in and of itself is awesome. Cross-platform code done right.
ios  email  c++  android  imap  cross-platform  objective-c 
march 2015 by andrewsardone
Easily convert between dictionaries and [HTTP] query strings in iOS and OS X.
objective-c  ios  cocoa  http  NSDictionary  swift 
february 2015 by andrewsardone
The easiest way to marshall and unmarshall Dictionary representations such as JSON representation.

It seemingly does more than [KZPropertyMapper][1] while still remaining conceptually simple.

- No subclassing required, but it can be used that way. One advantage to subclassing has to do with efficiently fetching managed objects
- Serializing and deserializing transformations, i.e., bi-directional like Mantle
- Simple declarative mapping, or more manual block-based mapping a
- Seemingly handles recursive relationships

via:mattb  github_repo  objective-c  iOS  mapper  swift  model  json 
january 2015 by andrewsardone
CoreObject is a version-controlled object database for Objective-C that supports powerful undo, semantic merging, and real-time collaborative editing.
objective-c  sqlite  distributed  git  etoile  versioncontrol 
december 2014 by andrewsardone
Facebook's iOS Infrastructure - @Scale 2014 Mobile - YouTube
Facebook talks about their immutable model and view layers.

It sounds really awesome, but there's a lot of hand waving – so much of the actual *work* is handled by their private libraries.
ios  mutability  immutability  reactjs  objective-c  objective-c++  coredata 
september 2014 by andrewsardone
Manages blocks of code that only need to run once on version updates in iOS apps.
objective-c  cocoa  ios  github_repo 
august 2014 by andrewsardone
@gparker on a problem Swift is solving
Problem: C code is too primitive, C++ code is too fragile, and Objective-C code is too hard to optimize.
swiftlang  objective-c  c 
june 2014 by andrewsardone
steipete/Aspects – Delightful, simple library for aspect oriented programming.
A promising aspect oriented programming library for Objective-C, perhaps useful for building up the [AOP analytics strategy][an].

aop  objective-c  github_repo  iOS 
may 2014 by andrewsardone
A code generator. Takes JSON templates describing a model, and turns them into Objective-C classes.

I’m not sure how this works just yet—there's very little documentation and I haven't jumped into the code—but I’m definitely watching this repo.
objective-c  cocoa  model  coredata  iOS 
april 2014 by andrewsardone Apple Claims Mogenerator’s Methods
The tl;dr; is a private Apple framework uses the open source library [mogenerator][mog]. Mogenerator adds some handy category methods to NSManagedContext, but since these methods exist within a private Apple framework they now look like private API to Apple's App Store validation tool.

Now people are finally coming around to namespaces being more than just needed by [“language wonks”][lw]. Naming techniques like class prefixes, underscores, or method name blemishes are not sustainable.

objective-c  ios  cocoa  coredata  namespaces  apple 
april 2014 by andrewsardone
Debug 32: John Siracusa on Copland 2014 | iMore
A good discussion between John Siracusa and Guy English on the state and sustainablity of Apple's developer ecosystem.

Given the Siracusa is basically [the originator of this discussion][copland2010], it's no surprise that he coherently argues the point, bouncing off of [new calls][af] to progress the developer tooling. English, on the other hand, seems content with burying his head in the sand.

objective-c  progress  programming  apple  ios 
april 2014 by andrewsardone
An Aspect Oriented Programming approach to iOS Analytics - Alberto De Bortoli
[Aspect Oriented Programming][aop] is the right approach for adding analytics tracking to your iOS projects. I've been frustrated by too many developers being content with peppering code bases with calls to Google Analytics, or dumping things into some god UIViewController base class.

The AOP technique combined with something like [ARAnalytics][ar] seems like it would make for a nice and modular analytics tracking setup. What has me worried, though, is the immaturity of of Objective-C AOP libraries. It doesn't look like there's a good one.

aop  analytics  objective-c  ios 
march 2014 by andrewsardone
MatthewYork/DateTools - Dates and times made easy in Objective-C
Some really nice additions to Foundation's already pretty good date handling.
DateTools was written to streamline date and time handling in Objective-C. Classes and concepts from other languages served as an inspiration for DateTools, especially the DateTime structure and Time Period Library for .NET. Through these classes and others, DateTools removes the boilerplate required to access date components, handles more nuanced date comparisons, and serves as the foundation for entirely new concepts like Time Periods and their collections.
foundation  objective-c  nsdate  nsdatecomponents  github_repo  via:cdzombak 
march 2014 by andrewsardone
Another player in the realm of static resources of various iOS components (images, strings, color plattes, storyboards, etc.)

I'm curious to try this out in comparison robjc:

robjc doesn't do everything objc-codegenutils, mostly just the asset catalog stuff. I *think* that's all I would want (I don't really use story boards or color palettes), and robjc seems “simpler”: it just traverses the filesystem and builds up some Objective-C files. I also like that it namespaces the assets to some degree, putting images in R.images, and strings in R.strings (just like Android).
objective-c  tool  xcode  ios  android  github_repo  UIKit 
march 2014 by andrewsardone
Using -rac_valuesAndChangesForKeyPath:options:observer: with -mutableArrayValueForKey:
A periodic reminder to manimuplate collections (like NSArray) through the proxy returned by -mutableArrayValueForKey:. That way, you'll get granular KVO notifications for changes, and then in Reactive Cocoa land you can get a signal for those changes via -rac_valuesAndChangesForKeyPath:options:observer:
kvo  cocoa  objective-c  ReactiveCocoa  NSArray 
march 2014 by andrewsardone
Quick Look Debugging with UIView - Ben Scheirman
This is included in UIViewController's view property, but you can add it to any UIView with a simple category.
xcode  cocoa  iOS  objective-c  debugger 
march 2014 by andrewsardone
robjc turns resources in Objective-C projects into compiled constants. from Android-land but with iOS.
ios  android  UIKit  github_repo  objective-c  ruby 
march 2014 by andrewsardone
A sensible way to deal with XML & HTML for iOS & Mac OS X
github_repo  objective-c  xml  libxml  html  parser 
march 2014 by andrewsardone
A key-value data store built on tour of SQLite. It markets itself as a Core Data alternative, and it does look promising. I appreciate not having to subclass some base object, and for concurrent connections out of the box.

Also notable that Storehouse switched from Core Data to YapDatabase:
iOS  coredata  database  objective-c  github_repo 
february 2014 by andrewsardone
objective c - Avoid extra static variables for associated objects keys - Stack Overflow
I can get down with using `@selector(selectorName)` as the `key` parameter in for `objc_getAssociatedObject` & `objc_setAssociatedObject`, or even just `_cmd` if I'm only accessing the associated object within one method.

This first piqued my interest when looking through some [Reactive Cocoa code][racc]

objective-c  runtime 
january 2014 by andrewsardone
Model-View-ViewModel for iOS | Teehan+Lax
The more I work with it the more I'm all about MVVM. When I gave my ‘Fixing your MVC’ talk, a lot of the principles were based on a sort of view-model-like setup.

These similarities and nuances on where you draw the line are important because we're all just trying to build better software. W'hat I do find annoying, though, is this common sleight of hand used by iOS developers with large UIViewControllers *and* proponents of MVC:
Under MVC, all objects are classified as either a model, a view, or a controller. Models hold data, views present an interactive interface to the user, and view controllers mediate the interaction between the model and the view.

There's this conflation that controller equals ‘view controller’, but that doesn't have to be the case! What's an NSFetchedResultsController? What's your APIClient class? They're all just controllers, it's just that too many developers just equate controller with UIViewController.
mvc  MVVM  programming  cocoa  objective-c  design 
january 2014 by andrewsardone
objc-run is a shell script which compiles and executes Objective-C source code files.

It's perfect for small programming tasks you want to handle in Objective-C, that don't justify setting up a complete Xcode project, e.g. manipulating plist files. Think of it as CodeRunner without an user interface.
via:iosdevweekly  shell  github_repo  objective-c 
january 2014 by andrewsardone
Drop-in compile-time key paths via a macro
From the guys at Square, it's a similar strategy to what the [extobjc] guys use. Something like this should be included in every project. It definitely beats plain old NSStrings or the NSStringFromSelector strategy as noted by [NSHipster].

kvo  kvc  objective-c  cocoa  macro 
january 2014 by andrewsardone
AFNetworking/AFNetworking discussion on prefixing category methods
For example: Naming collisions is not a problem only related to category methods but also to methods in subclasses. Every time you create a new method in your subclass you might re-implement a method that is already existing in the super-class. So if you were [consistent] you should in theory prefix/suffix all of your methods no matter whether we are talking about category or instance/class methods.

That is just one argument that can be made on behalf of not handling category methods any different.

A well-reasoned argument for saying “fuck it” when it comes to prefixing category methods. The only argument I can see for prefixing/suffixing these methods is for identifying what are extensions and what are part of the original author's class. I do like this when working with Reactive Cocoa – a clear delineation of what's in the higher abstraction of the reactive world – but in general I find the prefixes/suffixes to be ugly.

Also, this is just another reminder of the unfortunate bike shedding that goes on within the Objective-C community.
objective-c  bikeshedding  categories 
january 2014 by andrewsardone
XCPretty is a fast and flexible formatter for xcodebuild. It does one thing, and it should do it well.

1. echo "gem 'xcpretty'" >> Gemfile && bundle install
2. xcodebuild -workspace <workspace> -scheme <scheme> -sdk iphonesimulator test | bundle exec xcpretty -c
xcode  tools  build  objective-c  development  github_repo 
december 2013 by andrewsardone
Q Branch’s collection of Cocoa categories and utilities.
objective-c  cocoa  github_repo  ios 
december 2013 by andrewsardone
ReactiveCocoa essentials: Understanding and using RACCommand - SHAPE Code Blog
A good walkthrough of how to use RACCommand to send a network request and bind your UI to the various executing, completed, and error states.
reactiveprogramming  objective-c  ReactiveCocoa  frp  MVVM  RACCommand 
december 2013 by andrewsardone
Chris Eidhof | Lightweight Key-Value Observing
A good example of encapsulating a lot of the boilerplate and awkwardness around Cocoa's key-value observing API inside of a simple Observer object. This Observer object can handle registration and removal of observers, as well as provide a more target-action-like dispatch system.

A reminder that [THObserversAndBinders][thoab] is a good implementation of this pattern, and probably a go-to requirement for any app that's taking advantage of KVO.

kvo  objective-c  cocoa  oop  encapsulation 
october 2013 by andrewsardone
Using NSFetchedResultsController with an MKMapView
A good example of composing objects and implementations of abstract interfaces (protocols in Objective-C), namely NSFetchedResultsController and its delegate along with a MKMapView and its various markers made up of the MKAnnotation protocol.

via:cocoamanifest  nsfetchedresultscontroller  coredata  oop  objective-c 
august 2013 by andrewsardone
Strategies to support the new iOS7 UI | XS-Labs - Blog
Essentially, push your custom view drawing/etc into pre- and post-iOS 7 versions of the class, and turn the class into a class cluster: in `+[ alloc]` check the major iOS version provided by `+[UIDevice currentDevice]` and return an instance of the appropriate class.

+ ( id )alloc
if( [ self class ] == [ TestView class ] )
if( [ [ UIDevice currentDevice ] systemMajorVersion ] < 7 )
return [ TestViewIOS6 alloc ];
return [ TestViewIOS7 alloc ];
return [ super alloc ];
ios7  objective-c  iOS  via:cdzombak 
august 2013 by andrewsardone
git attributes for Objective-C implementation files – Twitter / cbarrett
Diff hunk headers will now display useful method names.

mkdir -p $HOME/.config/git
echo '*.m diff=objc' >> $HOME/.config/git/attributes
git  objective-c 
august 2013 by andrewsardone
Property Mapper [is] a simple self contained class that allows you to specify mapping between data you receive and data representation you have in your application.

The introductory blog post:

I lik that this doesn't require any subclassing, providing a declarative function to map properties from an NSDictionary to your model object.

I think this is another example of a must-have library for any iOS project that sucks down JSON and turns it into model objects (don't they all do that?)
iOS  github_repo  objective-c  mapper  model  json  via:github 
july 2013 by andrewsardone
GCC C Extension for local code block return – cocoa-dom
a GCC C extension causes a code block to return a value if you enclose it in round brackets

Almost makes for nicer builder-block-like chunk of C code.
objective-c  c  gcc  clang  llvm 
july 2013 by andrewsardone
NSArray<SomeClass> *arry = @[ [SomeClass new], [SomeClass new] ];
objective-c  generics  via:daveverwer  via:github  github_repo 
july 2013 by andrewsardone
KVO change wrapper
A simple wrapper object for the change dictionary of key-value observing events.
kvo  objective-c  kvc  ios 
june 2013 by andrewsardone
C99 Initializer Syntax in Objective C - Jaco Pretorius
I prefer the C99 struct initializer syntax, but I never thought about using its default values. For example, to create a CGRect with a zero origin (equivalent to CGPointZero):


c  objective-c  c99  struct  coregraphics 
june 2013 by andrewsardone
Mantle pull request to add Core Data adapter by jspahrsummers
This is an awesome feature and an awesome pull request.

I've been interested in [Mantle]( for a while, and this pull request adds in an adapter to handle serialization/deserialization of model object as NSManagedObjects. Now I'm even more interested in Mantle and will probably try to use it in a project.

The pull request is simply a great example of

1. Well organized commits
2. Good documentation
3. Clean and understandable code
coredata  objective-c  nsmanagedobjectcontext  via:github 
may 2013 by andrewsardone
ReactiveCocoa GitHub issue thread on using rac_lift to clarify one's intent
We prefer the more declarative style (selector lifting), because it makes the intention extremely clear.
ReactiveCocoa  reactiveprogramming  declarativeprogramming  objective-c 
may 2013 by andrewsardone
Deploymate for Xcode
Deploymate helps you identify unavailable, deprecated and obsolete API usage in your Xcode projects
objective-c  ios  xcode  tool 
april 2013 by andrewsardone
romaonthego/REFormattedNumberField · GitHub
A UITextField subclass that formats strings based on a priced format (e.g., +X (XXX) XXX-XXXX)
ios  objective-c  uitextfield  uikit  via:github  github_repo 
march 2013 by andrewsardone
Leak-Free Recursive Blocks
Tricky, because your block needs a reference to itself. That must be a weak reference, so you don't get a strong retain cycle, but *someone* needs a strong reference to it or ARC will dealloc it right away.


__weak __block block_t recurse;
block_t block;
recurse = block = ^(id val) {


objective-c  c  blocks  via:cdzombak 
march 2013 by andrewsardone
Building a Blocks-Based Object System in ⁠(⁠Objective⁠-⁠)⁠C – Ole Begemann
A simple object system by writing a C function that acts as an object constructor which builds up a bunch of blocks that represent methods and finally returning a "dispatch" block that takes a string and routes the string parameter to the respective method.
objective-c  blocks  oop 
february 2013 by andrewsardone
dcutting / HyperBek — Bitbucket
An Objective-C library for working with the JSON variant of Hypertext Application Language (HAL)[1].

ios  objective-c  hypermedia  hal  json 
february 2013 by andrewsardone
Overview — Clang 3.3 documentation
clang-format will potentially style C/C++/Obj-C code based on a style guide. Its promise reminds me of gofmt
c  objective-c  c++  tool 
january 2013 by andrewsardone
The Exceptional Beauty of Doom 3's Source Code
A comment from John Carmack in response to a writeup on the Doom3 source code walk through and its beauty. A couple of choice quotes I found interesting:
I sort of meandered into C++ with Doom 3 – I was an experienced C programmer with OOP background from NeXT’s Objective-C, so I just started writing C++ without any proper study of usage and idiom. In retrospect, I very much wish I had read Effective C++ and some other material. A couple of the other programmers had prior C++ experience, but they mostly followed the stylistic choices I set.

I am a full const nazi nowadays, and I chide any programmer that doesn’t const every variable and parameter that can be.

The major evolution that is still going on for me is towards a more functional programming style, which involves unlearning a lot of old habits, and backing away from some OOP directions.
c++  c  objective-c  oop 
january 2013 by andrewsardone
Variable Qualifiers in ARC – Apple Developer Center
ARC adds additional type qualifiers known as “lifetime qualifiers” for variables (used just like `const`):

- __strong (the default) – An object remains “alive” as long as there is a strong pointer to it.
- __weak – a reference that does not keep the referenced object alive. A weak reference is set to nil when there are no strong references to the object.
- __unsafe_unretained – a reference that does not keep the referenced object alive and is not set to nil when there are no strong references to the object. If the object it references is deallocated, the pointer is left dangling.
- __autoreleasing – denote arguments that are passed by reference (id *) and are autoreleased on return.

«You should decorate variables correctly. When using qualifiers in an object variable declaration, the correct format is:

ClassName * qualifier variableName;»

The example Apple's documentation uses:

MyClass * __weak myWeakReference;
MyClass * __unsafe_unretained myUnsafeReference;

Note the placement of __weak, specifically how it qualifies the pointer to MyClass and not MyClass as is usually seen in a lot of code:

MyClass * __weak myWeakReference; // correct
__weak MyClass *myWeakReference; // wrong

Apple even alludes to this common mistake and why it still “works”:

«Other variants are technically incorrect but are “forgiven” by the compiler. To understand the issue, see ªª»ºº

Also, nice shout out to ridiculous_fish from Apple's documentation.
objective-c  arc  c  cocoa  typequalifier  memorymanagement 
december 2012 by andrewsardone
Don't Forget the "C" in Objective-C: C Declarations
A good writeup/collection of resources re: C and its declarations and how they relate to Apple/LLVM's ARC extensions.
c  memorymanagement  objective-c  typequalifier  arc 
december 2012 by andrewsardone
ARC Best Practices
A good collection of some of ARC tougher and less refined points. I particularly like, for reference, the section on bridging memory-semantics:

id my_id;
CFStringRef my_cfref;
NSString *a = (__bridge NSString*)my_cfref; // Noop cast.
CFStringRef b = (__bridge CFStringRef)my_id; // Noop cast.
NSString *c = (__bridge_transfer NSString*)my_cfref; // -1 on the CFRef
CFStringRef d = (__bridge_retained CFStringRef)my_id; // returned CFRef +1

- __bridge is a noop (with respect to memory management)
- __bridge_transfer is for changing CF references to Objective C objects. ARC will release the ObjC object for you. Make sure that the CFRef has +1 retain count.
- __bridge_retained is for changing Objective C objects to CF references. This will effective give you a CF reference with a +1 retain count. You are responsible for calling CFRelease on the CFRef at some point in the future.

It also good to note the compiler's behavior around NSError out-parameters (indirect pointers) and ARC autoreleasing:

«In ARC, out-parameters are by default __autoreleasing [i.e., passed-by-refernces that are autoreleased on return] and should [add the __autoreleasing ownership qualifier to their declaration]…If you forget the __autoreleasing, the compiler will simply insert a temporary, intermediate autoreleasing object for you. This was a compromise made under the oppressive regime of backwards compatibility. I have seen some compiler configurations which do not automatically make them __autoreleasing. It is safer to include the __autoreleasing for all new code.»
objective-c  cocoa  arc  c 
december 2012 by andrewsardone
« earlier      
per page:    204080120160

related tags

activerecord  afnetworking  analytics  android  aop  apple  arc  async  awesome  bdd  bikeshedding  bindings  blocks  build  c  c#  c++  c99  callbacks  categories  clang  cocoa  cocoapods  codeoptional  community  complexity  composition  computer-science  coreanimation  coredata  coregraphics  cross-platform  database  debugger  declarativeprogramming  design  development  distributed  dsl  email  encapsulation  enum  etoile  feature-flag  foundation  frp  functional  futures  gcc  gcd  gcov  generics  gif  git  github  github_repo  golang  hal  html  http  hypermedia  ifttt  imap  immutability  ios  ios7  iphone5  java  javascript  javascriptcore  json  kvc  kvo  language  layout  libxml  llvm  mac  macro  mapbox  mapper  mapreduce  markdown  memory  memorymanagement  model  mutability  mvc  MVVM  namespaces  networking  NSArray  nsattributedstring  nsdate  nsdatecomponents  NSDictionary  nsfetchedresultscontroller  nsmanagedobjectcontext  nsstring  objective-c  objective-c++  onethingwell  oop  open-source  OpenGL  osx  parser  php  pointers  programming  progress  promises  RACCommand  ReactiveCocoa  reactiveprogramming  reactjs  reference  regex  regularexpression  ruby  runtime  shell  sqlite  static_analysis  Steve_Jobs  struct  swift  swiftlang  swift_lang  tdd  technicaldebt  testing  tips  tool  tools  tutorial  typequalifier  uiimage  UIImageView  uikit  uitextfield  valueobject  versioncontrol  via:andyfowler  via:cdzombak  via:cocoamanifest  via:daveverwer  via:github  via:iosdevweekly  via:mattb  web  webapps  webobjects  xcode  xml 

Copy this bookmark: