Stuck in Swift

2014-08-14 Thread Gerriet M. Denkmann
I have a class called SomeClass which should be able to set some TextFields. But it just does not compile. And the error message: "'String' is not a subtype of 'AppDelegate'" while certainly true, is not too helpful. I tried several variations, but I just can't get it to compile. Very frustratin

Abandoning NSDocument for an app

2014-08-14 Thread Daryle Walker
I’ve been trying to follow Apple’s guide on WebView, and some parts use the NSDocument architecture for their browser app part examples. However, the dependencies for a document app is: model (custom) -> model management in the large (NSDocumentController) -> individual models (NSDocument) -> d

Re: Stuck in Swift

2014-08-14 Thread Muhammad Hussein Nasrollahpour
The problem is with your calling convention in specified line. Notice that when you call a method which is part of a class you should write the parameter name and then value. class AppDelegate: NSObject { var statusString : String? // 1. let someThing = SomeClass(myStat

Re: Stuck in Swift

2014-08-14 Thread Gerriet M. Denkmann
On 14 Aug 2014, at 14:45, Muhammad Hussein Nasrollahpour wrote: > The problem is with your calling convention in specified line. Notice that > when you call a method which is part of a class you should write the > parameter name and then value. Ok. You are right. > class AppDelegate: NSObj

Re: KVO query

2014-08-14 Thread Jonathan Mitchell
On 13 Aug 2014, at 23:41, Quincey Morris wrote: > On Aug 13, 2014, at 14:53 , Jonathan Mitchell wrote: > >> At one point i need to invoke a manual KVO notification like so: >> >> [submission willChangeValueForKey:@“status”]; >> [submission didChangeValueForKey:@“status”]; >> >> This raises

Re: KVO query

2014-08-14 Thread Jonathan Mitchell
On 13 Aug 2014, at 23:40, Ken Thomases wrote: > > You have to issue the -willChange… _before_ the property has changed. That's > because that's KVO's only opportunity to get the value that's about to become > "old" and remove its observations for the properties of that old object. > > So, t

Re: diff tool on iOS?

2014-08-14 Thread Koen van der Drift
For the record, I ended up using this: https://github.com/inquisitiveSoft/DiffMatchPatch-ObjC - Koen. On Aug 13, 2014, at 1:03 PM, Marco S Hyman wrote: > On Aug 13, 2014, at 7:54 AM, Koen van der Drift > wrote: > >> Any tips for where I can find the source code for BSD diff? I found the G

Re: Stuck in Swift

2014-08-14 Thread Roland King
> > class AppDelegate: NSObject > { > dynamic var statusString : String? // bound to some TextField > > let someThing = SomeClass( myStatusHandler )< this > creates strange error messages > > func myStatusHandler( s: String ) > { >

Re: Translating to Swift

2014-08-14 Thread Gerriet M. Denkmann
On 13 Aug 2014, at 17:35, Jean-Daniel Dupas wrote: > At global scope > > var sharedThing : Thing = Thing(); > Excellent. Just what I needed. But: is this thread-safe? What if several threads are trying to use the sharedThing? The Swift book doesn't mention the word "thread". Kind regards,

Re: Translating to Swift

2014-08-14 Thread Quincey Morris
On Aug 14, 2014, at 11:44 , Gerriet M. Denkmann wrote: > But: is this thread-safe? What if several threads are trying to use the > sharedThing? Jean-Daniel is teasing you slightly. It *is* thread-safe. For the reason, look at the August 1 entry in the Swift blog: https://developer.app

Re: Translating to Swift

2014-08-14 Thread Jean-Daniel Dupas
In fact, this is actually exactly equivalent to you sample. Global and class variable initialization on Swift is performed lazily and is implemented using dispatch_once(). And after a second thought, I think that it should be 'let' and not 'var', and you don't want the pointer to be changed aft

Re: Translating to Swift

2014-08-14 Thread Roland King
> > I don't remember if static class variable are supported yet, but if they are, > you can also use one instead of a global. Not yet. Not yet even confirmed for Swift 1.0 release as far as I recall from the last devforum message I read on this.

Re: Stuck in Swift

2014-08-14 Thread Marco S Hyman
On Aug 14, 2014, at 1:51 AM, Gerriet M. Denkmann wrote: > Well, it should, but it does not. I still get the error: 'String' is not a > subtype of 'AppDelegate' Note the location of the error. The compiler is complaining that myStatusHandler is the wrong type in this line: > let someThin

Re: Translating to Swift

2014-08-14 Thread Gerriet M. Denkmann
On 15 Aug 2014, at 02:50, Quincey Morris wrote: > On Aug 14, 2014, at 11:44 , Gerriet M. Denkmann wrote: > >> But: is this thread-safe? What if several threads are trying to use the >> sharedThing? > > Jean-Daniel is teasing you slightly. It *is* thread-safe. For the reason, > look at the

Re: Translating to Swift

2014-08-14 Thread Quincey Morris
On Aug 14, 2014, at 19:17 , Gerriet M. Denkmann wrote: > But does "global variable" means "var"? > Jean-Daniel rightly says: " I think that it should be 'let' and not 'var', > and you don't want the pointer to be changed after initialization" I know nothing about the real answer, but my guess

Quickie about constraints

2014-08-14 Thread Graham Cox
What level are constraints implemented at? Are they per window, or more fine-grained? I ask because I'm having trouble getting part of my interface working with autolayout, though other parts work fine. Since the part that doesn't work works just fine with struts-and-springs, and has done for a