iOS & macOS development
132.9K views | +0 today
iOS & macOS development
cool tips and source code for Cocoa, Swift and Objective-C
Curated by Alessio Nonni
Your new post is loading...
Your new post is loading...
Scoop.it!

TTTAttributedLabel

TTTAttributedLabel | iOS & macOS development | Scoop.it

TTTAttributedLabel - A drop-in replacement for UILabel that supports NSAttributedStrings.

 

NSAttributedString is pretty rad. When it was ported into iOS 4 from Mac OS, iPhone developers everywhere rejoiced. Unfortunately, as of iOS 4 none of the standard controls in UIKit support it. Bummer.

 

TTTAttributedLabel was created to be a drop-in replacement for UILabel, that provided a simple API to styling text with NSAttributedString while remaining performant. As a bonus, it also supports link embedding, both automatically with UIDataDetectorTypes and manually by specifying a range for a URL, address, phone number, or event.

No comment yet.
Scoop.it!

mikeash.com: Friday Q&A 2011-09-30: Automatic Reference Counting

Since the moment Apple announced it, readers have asked me to write about Automatic Reference Counting, or ARC. Today is the day. I'll talk about Apple's new memory management system, how it works, and how to get the most out of it.

No comment yet.
Scoop.it!

PSStackedView

PSStackedView | iOS & macOS development | Scoop.it

PSStackedView - put your UIViewControllers in a stack, inspired by Twitter's iPAD UI.


After reviewing other stacked implementations, i wrote my own solutions from scratch. This one lets you add plain UIViewControllers to a PSStackedViewRootViewController, working much like a UINavigationController.

 

All the hard parts, moving, shadows, rounded borders is taken care of.

 

I made it for the iPad-Version of the popular austrian TV app "3MobileTV". (You need an austrian 3-SIM to test it, but you can check out the screenshots to get the idea what's possible with it).

 

Currently there is a positioning bug with small view controllers, I'll fix that in the foreseeable future. Otherwise, it's pretty much a drop-in-replacement for UINavigationController, using regular UIViewControllers. It supports iOS4 upwards, with some special support for iOS5's new view controller containment coming.

 

It works on the iPad and the iPhone, but the concept is better suited for the iPad.

No comment yet.
Scoop.it!

QuincyKit

QuincyKit | iOS & macOS development | Scoop.it

Live Crash Report Management
Collect crash reports from your apps, either from your beta versions or from release versions (AppStore safe!). Your apps can report crash reports right at the next startup of your app to your server setup.


Statistics
See all your crash reports automatically grouped by similar crashes and how each crash group developed over time and see the affected OS versions and platforms.


Multi Platform Support
QuincyKit supports both Mac OS X and iOS platforms.

 

QuincyKit is available under the MIT Open Source license. The source code is available on GitHub.

No comment yet.
Scoop.it!

DCIntrospect - Small library of visual debugging tools for iOS

DCIntrospect - Small library of visual debugging tools for iOS | iOS & macOS development | Scoop.it

Introspect is small set of tools for iOS that aid in debugging user interfaces built with UIKit. It's especially useful for UI layouts that are dynamically created or can change during runtime, or for tuning performance by finding non-opaque views or views that are re-drawing unnecessarily. It's designed for use in the iPhone simulator, but can also be used on a device.

No comment yet.
Scoop.it!

A note on Objective-C singletons

I'm not a big fan of singletons, especially when they are used as they often are - as glorified globals. That being said, it occasionally makes sense to have some kind of shared instance of an object; not a true singleton that strictly prevents more than one allocation, but a convenient default instance.

 

Apple uses this pattern frequently throughout their frameworks: [NSUserDefaults standardUserDefaults], [UIScreen mainScreen] and many, many more.

 

Conceptually, I like to think of these methods as convenient accessors to instances representing a shared or common resource rather than singletons and I still try and avoid using them as globals where possible.

No comment yet.
Scoop.it!

iOS 5 Face Detection with Core Image

iOS 5 Face Detection with Core Image | iOS & macOS development | Scoop.it

One of the great new features of iOS 5 is the addition of the Core Image (CI) framework.

This framework has been available for a few years on the Mac, but now its advanced image processing and filtering capabilities are available on the iOS platform as well.

One particularly cool new feature available in Core Image, on both iOS 5 and Lion, is its ability to detect faces in an image.

No comment yet.
Scoop.it!

iOS 5 : Customize UINavigationBar and UIBarButtonItem with the Appearance API

In a previous post, UIImage and resizableImageWithCapInsets, I explained how to use the method resizableImageWithCapInsets in a UIImage object to set cap insets, which specify areas of an image that are not to be changed when resizing or scaling an image. That post was a segue to this post, which will use images (and cap insets) as part of the iOS 5 appearance API and customizing the navigation bar.

No comment yet.
Scoop.it!

MBRequest — A simple networking library for iOS and OS X

Announcing MBRequest, a simple, open source library for making network requests on iOS and Mac OS X.

 

Making network requests is one of the most common activities apps perform, especially on mobile devices that are always connected to the internet. While Apple gives us some classes and tools to help us perform these requests, it is left as an exercise to the developer to do so in a clean, reusable way.

No comment yet.
Scoop.it!

ALPopupView

ALPopupView | iOS & macOS development | Scoop.it

ALPopupView is a flexible Facebook-like popup view that you can use to display any content you'd like: alert and notification messages, images, scrollable text, a web page, or anything else.

Scoop.it!

Objective-C Literals, part 2

Every change to a programming language comes with implications. These are some issues that come to mind immediately, and I am sure that more will appear as more programmers of different abilities and viewpoints use the literal syntax and use the classes that support indexed and keyed access.

The literal syntax is extremely convenient. A pile of ugly code gets turned into something straightforward, almost beautiful. The downside is that this can lead to more stuff being hard-coded in source files that should really be gotten from somewhere else, like a plist file or from user defaults.

No comment yet.
Scoop.it!

Reachability

Reachability | iOS & macOS development | Scoop.it

ARC and GCD Compatible Reachability Class for iOS and MacOS. Drop in replacement for Apple Reachability.

No comment yet.
Scoop.it!

HttpShell

HttpShell | iOS & macOS development | Scoop.it

An interactive shell for issuing HTTP commands to a web server or REST API.


Issue HTTP commands (HEAD, GET, POST, PUT, DELETE, OPTIONS, TRACE) to a server with interactive feedback. Makes debugging and testing REST services and public APIs much easier than with cURL.

No comment yet.
Scoop.it!

Objective-C Expressions for Debugging

In a previous post I wrote about preprocessor macros that provide filename, line number and function information to aid in debugging. A short example follows...

No comment yet.
Scoop.it!

NSURLCache uses a disk-cache as of iOS5

While writing AFDownloadRequestOperation, a new subclass for AFNetworking I discovered that the behavior of NSURLCache changed between iOS 4.x and iOS 5.x.


Before iOS5, NSURLCache just saved requests to memory, even if the documentation said otherwise - the diskCapacity property was silently ignored. This led to some open source subclasses of NSURLCache, that retrofit disc caching. Most popular is SDURLCache and my enhanced, faster fork of it. Even Apple has an example online that shows how to create a simple URLCache.


As of iOS5, NSURLCache automatically saves responses to disk. I haven’t found anything the release notes that confirms the change, but I tried it both with iOS 4.3/5.0/5.1 on the simulator and the device, and with every 5.x version a disk cache file is created and populated. This is great, as many developers probably aren’t aware of this and the system just does the right thing - and it’s fast.

No comment yet.
Scoop.it!

Auto-incrementing Build Numbers in Xcode

Users and testers will find bugs you are sure you have already fixed. Sometimes they use the wrong version, sometimes your fix is not as good as you thought. Either way a tiny unique version number visible in the app can save you hours of work.

 

Incrementing the version number of your project for every small update is often not feasible, if it involves manual labor it just does not get done. Would it not be nice if Xcode just autoincremented a build number for you every time you build?

 

No comment yet.
Scoop.it!

NSLogger

NSLogger | iOS & macOS development | Scoop.it

NSLogger is a high perfomance logging utility which displays traces emitted by client applications running on Mac OS X or iOS (iPhone OS). It replaces your usual NSLog()-based traces and provides powerful additions like display filtering, image and binary logging, traces buffering, timing information, etc.

 

NSLogger feature summary:

 

- View logs using the Mac OS X desktop viewer, accept connections from local network clients (using Bonjour) or remote clients connecting directly over the internet


- Online (application running and connected to NSLogger) and offline (saved logs) log viewing

 

- Buffer all traces in memory or in a file, send them over to viewer when a connection is acquired

 

- Secure logging (connections use SSL by default)

 

- Advanced log filtering options

 

- Save viewer logs to share them and/or review them later

 

- Export logs to text files

 

- Open raw buffered traces files that you brought back from client applications not directly connected to the log viewer

No comment yet.
Scoop.it!

SecureUDID

SecureUDID | iOS & macOS development | Scoop.it

SecureUDID is an open-source sandboxed device identifier solution aimed at solving the main privacy issues that caused Apple to deprecate UDIDs.

 

SecureUDIDs have the following attributes:

 

Developers can still differentiate between devices as if they were still using a UDID, but only within apps they control.


User privacy is protected since developers are fundamentally prevented from accessing the same UDID as another developer. This greatly limits the scope of any potential leaks.


End-users can globally opt-out of SecureUDID collection across all applications and services that use it.

No comment yet.
Scoop.it!

Dot Dot Dot

Emacs or Vim? Tabs or Spaces? Mac or PC? There are many arguments between developers. One of the biggest ones in the Objective-C community is over dot-syntax. It's the argument that just keeps going. I'm on the side that doesn't particularly like dot syntax, but people often misunderstand the reasoning behind this position. So I'm going to outline it here.

No comment yet.
Scoop.it!

NSScreencast: Bite-sized Screencasts for iOS Development

NSScreencast: Bite-sized Screencasts for iOS Development | iOS & macOS development | Scoop.it
No comment yet.
Scoop.it!

Instance Variables in the Implementation File

Within Xcode, if you set the compiler option to Apple LLVM compiler 2.1 (or greater), you can move your instance variable declarations from the interface file to the implementation file.

No comment yet.
Scoop.it!

Subclassing Those Hard-to-Reach Classes

How to use NSKeyedArchiver and NSKeyedUnarchiver to change the class of an existing object.

No comment yet.
Scoop.it!

How To Create Cool Effects with Custom Shaders in OpenGL ES 2.0 and Cocos2D 2.X

How To Create Cool Effects with Custom Shaders in OpenGL ES 2.0 and Cocos2D 2.X | iOS & macOS development | Scoop.it


Learn how to make cool effects like this with Cocos2D 2.0 shaders.


Shaders may very well be the biggest step forward in computer graphics since the introduction of 3D into games. They allow programmers to create completely new effects and take full control of what’s seen on the screen. If you aren’t using shaders yet, you will be after reading this tutorial.


Cocos2D is one of the best iOS game frameworks available at the moment, and fortunately for us, Cocos2D 2.X now supports OpenGL-ES 2.0 and shaders. In this tutorial, you’ll learn how to create and use shaders with the help of Cocos2D.

No comment yet.
Scoop.it!

Objective-C Literals, Part 1

Looks like the cat is out of the bag, the new Objective-C literals have landed into the clang trunk. This change introduces additional Objective-C Literals.


What is an “Objective-C Literal”? It’s a chunk of code that references a specific Cocoa object, creating it if necessary. Objective-C has had literals for NSStrings since the beginning of time: NSString *greeble = @"Bork Bork Bork";


The syntax is an at-sign, the indication that Objective-C magic is approaching, in front of a C-string literal. This makes an NSString that can be used just like any other NSString. In fact, greeble points to an actual NSString, it’s not any kind of second-class citizen. The new literals for NSNumbers, NSArrays, and NSDictionaries take a similar approach.

No comment yet.
Scoop.it!

ActionSheetPicker

ActionSheetPicker | iOS & macOS development | Scoop.it
ActionSheetPicker - Quickly reproduce the dropdown UIPickerView / ActionSheet functionality from Safari on iPhone/ iOS / CocoaTouch.
No comment yet.