I’m currently trying to write a function in Obj-C which allows me to type a char (into a NSTextField), wait for e.g. 30 Milliseconds and type the next char of a NSString.
eg;
NSString * st = @"hello, world";
NSTextField * tf;
char curr;
int index = 0;
int i;
for(i=0;i<[st length]; i++){
curr = [st characterAtIndex:index];
index++;
//Now append the char to the NSTextField tf;
//Wait 30 milliseconds
}
Doing this within a single function will block the UI unless you go through all the trouble of running the runloop yourself. The idiomatic solution is just to use an NSTimer.