BuySellAds.com

Until Dec 3rd, 44% off all Manning books, including Barcodes with iOS! Promo code: mobicftw
Our DNA is written in Objective-C
Jump

Wrapping a Dynamic C-Array

For version 0.2.0 of DTMarkdownParser I needed an array that would allow me to look up the string range for individual lines of a string. My initial approach was to simple use the provided method of NSValue to wrap an NSRange in it. The problem with this approach is that as the number of ranges in the array grows so does the time needed to find a range at a higher index.

Jan Weiß of Geheimwerk suggested to replace this approach with one based on C memory allocation and searching functions. This required me to brush up on my dynamic C-array allocation skills which had become somewhat rusty from only using Objective-C objects for everything. The techniques I’ll be discussing in this blog might be of great value to you, too, if you ever find yourself needing to quickly find a scalar value (i.e. a number or struct) in a dynamically sizing array.

Read more

DTMarkdownParser 0.2.0

DTMarkdownParser, our event-based parser for Markdown, has much progressed since 0.1.0. Since I will not be able to work on this as much in the coming weeks and it has reached a nice stable state I’m releasing this new development version.

Read more

Blurring Views on Mac

“Frosted Glass” abounds on iOS 7 and this new look is the new “Corinthian Leather”. Apple has often used design ideas from their mobile OS and let them inform UI design on OS X. This begs the question: where is frosted glass on Mac?

Mac developer Raffael Hannemann offered to do a guest tutorial for Cocoanetics.com demonstrating how to achieve the same view blurring effect on Mac, where you are much less constrained by the GPU performance. On Mac the necessary ingredients for view blurring are readily available.

On iOS Apple kept the necessary APIs for blurring private for the time being because of a severe performance problem that goes hand in hand with live Gaussian blurring. Raffel’s blog post after the break.

Read more

DTMarkdownParser 0.1.0

My book publisher offers me two options for submitting text, Microsoft Word or an XML-based format. I’ve grown quite fond of Markdown lately and so I formed the idea that I could write my book in markdown and use a parser to create this XML from it.

And since I like to craft my own libraries (because most of the time I’m learning something in the process) I started to work on DTMarkdownParser.

Read more

Writing a Book

Antique Typewriter

A couple of months ago a publisher contacted me about writing a book. I have written a lot in my lifetime, blogging in general on my German-language personal blog and later on my Cocoa development blog Cocoanetics. But of course I’ve never written something spanning more than a couple of pages.

Like everybody who likes to write I’ve toyed with the idea, but not knowing about what is involved in creating a technical book I shied away from it. I was assuming that all those book authors have to take time off their normal jobs for writing. I couldn’t imagine exclusively writing for 6 months and not having time for my regular development interests.

But then there was this contact who took the time to walk me through the initial steps toward my first book contract.

Read more

Don’t Cross The Streams

Like most people I could get buy blissfully without dealing too much with Auto Layout. But there are layout-heavy scenarios where you start having the feeling that they might be much easier to solve using auto layout than by setting autoresizing masks (aka “struts and springs”).

One such example is the layout of controls in an inspector panel where I laid out the controls distanced from each other with layout constraints in Interface Builder. Architecture-wise I am using such an “inspector palette” in a DMInspectorPalette which gives me several collapsible sections. These are contained in a NSTabView (using DMTabBar as header) to get multiple inspectors laid out like in Xcode. And these are the right-most view in an NSSplitView to allow resizing of the inspector panel.

I was having some issues with that beginning with 10.9 which I’d like to document here.

Read more

-fobj-arc is not supported on platforms using the legacy runtime

The Cocoanaut asked on Twitter:

“Does anybody know what this error means? (compiled on a white MacBook with 10.7.5 and Xcode 4.6.3)”

He attached this screenshot:

-fobjc-arc not supported

I’ve been seeing this error quite often lately and so I’d like to document my answer for posteriority.

Read more

DTRichTextEditor 1.6.4

This is a maintenance update for DTRichTextEditor which includes several fixes for iOS 7. It also brings all the improvements from DTCoreText 1.6.8 into our commercial editing component.

Read more

Radar Double Feature: Xcode Crash and Unit Test with UIFont

While working on unit tests for DTCoreText I stumbled upon an issue that has two aspects, one for how you set up unit tests and the other is a crash that is new as of Xcode 5.0.1.

Consider this simple unit test:

- (void)testExample
{
   UIFont *font = [UIFont fontWithName:@"Helvetica"
                                  size:20];
   STAssertNotNil(font, @"font should not be nil");
}

I consider it esoteric knowledge that you have to have a test host in place if you want to instantiate a UIFont inside a unit test. This is why I am filing it as a bug report, since it “might lead to developer confusion”.

In the least this should be documented somewhere. You will also find a description of a minimalistic workaround for both issues.

Read more

DTCoreText 1.6.8

This update for DTCoreText is our most error-free release ever! We added tons of new unit tests and added code coverage monitoring via Coveralls. And in doing so we found a plethora of little bugs creeping around in little untested (“uncovered”) code.

Read more