Ad

Our DNA is written in Swift
Jump

Radar: Horizontal Line Autolayout and Layer-Backing

There are apparently a great many views on Mac that don’t behave properly if you enable layer-backing. I recently reported a bug in drawing NSTextField backgrounds together with layer-backing, now here is a bug I found in NSBox.

Filed as rdar://13059657

Read more

DTCoreText 1.2.0

Funny Story: right after I published my findings on how to work CocoaPods I received a couple of pull requests. Should it be actually be the case that fellow developers are beginning to take notice of DTCoreText?

I admit, that for the first few tags/versions of DTCoreText I didn’t take CocoaPods seriously. But since I got down how to work with sub-modules and sub-specs I find that it gives me a great deal of pleasure to keep my specs current.

Read more

OMG, GCD+ARC

There are a few trailblazing developers out there who intentionally set their app’s deployment target to iOS 6. When dealing with open source libraries like DTCoreText this might give you a fair share of deprecation warnings. But there is also another problem caused by this that library vendors need to address.

The SDK used should always be the Latest iOS, but the Deployment Target setting tells the compiler and linker at what level of fanciness it can enable the turbo features.

Read more

Digging into CocoaPods

There once was a developer who figured that it would make sense to not reinvent the wheel, or at least not all 4 that he needed for his app/car. He had previously learned how to contribute to open source projects on github and wrapped his head around git submodules. As long as you stay in the git ecosystem all is bliss, submodules contain Xcode projects which are easily added as sub-projects.

The big advantage of sub-projects is that you can debug into these and if you fix something you can easily push that back to the master repository. But this convenience brings with it a drawback: since you have to keep a copy of each sub-module in each project structure that needs them you risk ending up with many different versions of many different components all over your file system.

Read more

Radar: NSTextField Redrawing of Background With Layer-Backing

I noticed this bug in NSTextField already back last year but I procrastinated until I saw it the second time in the second Mac app I am building. I did have a workaround for the bug, so it was not that pressing.

But I guess we should consider it our duty as Mac developers to make sure that Apple knows about bugs for this platform. So finally here’s my Radar for it. rdar://13006140

Read more

Open In … All Files

Let’s say you are building an app that does some sort of file handling where you want to be able to open any and all file types in your app. When your app then launches it would do something with the file, like upload it to a server.

I was not quite certain how to achieve this effect myself, so I turned to Dropbox who are doing exactly that. If you have the Dropbox iOS app install you can open any file in Dropbox. Then you can choose where to put it in your online storage.

How did they do that? Did they register for a truckload of file types? Or is there a shortcut that I didn’t know about yet?

Read more

Ziner Uses DTCoreText

You know I love to hear from developers who are making good use of my open source or commercial components in released apps. A shining example of lat is Ziner.

Ziner is the latest entry in the battle for the best Google Reader client, fighting it out with other heavyweights Reeder, Feedly, Flipboard, Mr. Reader, FeeddlerRSS and Newsify.

I asked Ziner’s developer Jay Zhao to share with us a bit of the back story of Ziner.

Read more

How to send image to remote server

Somebody asked on StackOverflow:

how to send image to Remote server from the below code last string is placed with image

NSString *reqString=[NSString stringWithFormat:@”http://projeceads.info/spir/productinfo/productadd/%@/%@/%@/%@/%@/%@/%@/%@”,ownerId,productNameTxt.text,QuantityTxt.text,sizeTxt.text,ageTxt.text,priceTxt.text,descriptionView.text,imgstr]; NSURL *reqUrl=[NSURL URLWithString:reqString]; NSURLConnection *connection=[[NSURLConnection alloc]initWithRequest:[NSURLRequest requestWithURL:reqUrl] delegate:self];
[connection start]; }

Now there are several things wrong with this question. This is the very first question this person asked on StackOverflow and he didn’t even set a proper user name yet. The code is not formatted as such, the English is bad and to most casual onlookers it is unclear what this question is about.

Still I felt an urge to give a good answer because often it is non-sensical questions like this that challenge our ability to parse the intent of the asking person and our knowledge of the subject matter. It is also such a situation where you can give an answer that exactly matches the question as well as a second answer that is a better way of achieving the intent.

Read more

Apple-converted-space

When using HTML to represent text that the user can edit you will meet a problem: HTML compresses whitespace. Tabs or newlines or even multiple spaces all get compressed to single spaces. That is, unless you enable the same sort of whitespace handling that PRE tags are using.

I was curious how Apple’s own NSHTMLWriter would be avoiding whitespace compression. And there I found a creative approach and adopted the same technique in my DTHTMLWriter which allows you to generate HTML from attributed strings.

Read more

2012 in Review(s)

I recently revealed that app sales only make up about 4% of our company revenues. Because of this we don’t have much budget to invest into our apps and the reasonable view is to see them as glorified hobby projects.

Nevertheless it is nice to go back over the past year in reviews to pick out the ones that transport the best emotions. There are many people who use app reviews as a sounding board for themselves and write things there that they never would say to a developer in person. Thus it is permissible to pick out the few reviews that give us the best feeling and ignore the rest.

Read more