thomasguenzel.com

Apps/Programming

Tag: mac

Changing the Application Language in AppCode

When developing apps that support multiple languages I used to set the system language in the iOS Simulator settings, which required a complete reboot of the simulator. I then discovered the Application Language setting when editing build schemes in XCode under the Options tab.

Unfortunately, AppCode doesn’t have this option (or maybe I just didn’t find it). But an easy workaround is to choose Edit Configurations… in AppCode and specifying the following as Program Arguments:

-AppleLanguages (de)

where “de” specifies the language, in this case German, although “German” or “de_DE” will also work.

To easily switch between different languages, you can copy the configuration for each language and set the corresponding language code.

Search and Replace 1.2.2

A new version of Search and Replace is available on the Mac App Store. It includes a brand new Live Editor, where you can test your rules in a small editor.

Automatically Update the Title of a View-Controller Based NSTabViewItem

Currently I’m working on yet another Mac app, where I have a NSTabView with multiple tabs that each represent a view controller.
I noticed that when I set my view controller’s title with

self.title = @"some other title"

nothing changes. So I wrote a small NSTabViewItem subclass that updates the title automatically by observing the title key of the view controller.

The code is on github and you can find the important part below.

@implementation GNTabViewItem

-(void)dealloc {
	[self.viewController removeObserver:self forKeyPath:@"title"];
}

-(void)setViewController:(NSViewController *)viewController {
	[self.viewController removeObserver:self forKeyPath:@"title"];
	[super setViewController:viewController];
	[self.viewController addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:nil];
}

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
	if([keyPath isEqualToString:@"title"] && object == self.viewController) {
		self.label = self.viewController.title;
		return;
	}
	[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}

@end

Search and Replace on the Mac App Store

Just a few minutes ago my newest app, Search and Replace, went online! It’s a helpful tool if you need to perform search and replace operations on multiple files. You can also use regular expressions for complex operations.

Take a look at it here.

Setting up a File Type for your Mac App

As I often have problems setting up a custom filetype for my Document-Based Applications I decided to write a short tutorial on how to do it (actually just one image). You just need to enter most of the information twice, once for the Document Type and once for the Exported UTI.
Look at those two lists for what types you have to choose:
List of Uniform Type Identifiers
Wikipedia Article about MIME (including common types)

filetypetut

SpaceDebris online

My newest game, SpaceDebris, is now online in the App Store and Mac App Store. Check it out!

© 2024 thomasguenzel.com

Theme by Anders NorenUp ↑