Do NSStackView's actually work in a NSTableView?

2015-04-02 Thread Sebastien Boisvert
I only ask because I’m using a stackview that while it behaves as I configured it in a plain view in a window, it behaves completely different when put in a tableview. For example, views which I’ve set to detach will never, ever detach, regardless of the settings I’ve set. Anyone have experienc

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Quincey Morris
On Apr 2, 2015, at 19:28 , Charles Jenkins wrote: > > I can indeed call attrStr.string.rangeOfCharacterFromSet(). But in typical > Swift string fashion, the return type is as unfriendly as possible: > Range? — as if the NSString were a Swift string. I finally read the whole of what you said he

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Quincey Morris
On Apr 2, 2015, at 19:28 , Charles Jenkins wrote: > > So after doing two anchored searches, one at the beginning and one at the end > of the string, if I get two different ranges, I’m stuck with two values that > aren’t subtractable to determine the length of the NSRange I need in a call > to

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Charles Jenkins
Amen, brother. Given my attributed string “attrStr,” I can indeed call attrStr.string.rangeOfCharacterFromSet(). But in typical Swift string fashion, the return type is as unfriendly as possible: Range? — as if the NSString were a Swift string. So after doing two anchored searches, one at the

Re: NSWindow Subclass close/dealloc question

2015-04-02 Thread Dave
> > No, then the window will be uncloseable. What needs to be different > depending on that property is whether you call -release, not whether you pass > the -close call up to super. If you're using ARC, you don't get to control > whether you call release. Therefore, you need to set released

Re: NSWindow Subclass close/dealloc question

2015-04-02 Thread Ken Thomases
On Apr 2, 2015, at 11:53 AM, Dave wrote: > On 2 Apr 2015, at 17:09, Ken Thomases wrote: >> >> On Apr 2, 2015, at 10:56 AM, Dave wrote: >> >>> I’m getting a crash in dealloc in an NSWindow Subclass. >> >>> If I run this, then I get a crash when the autorelease pool is drained. >>> However, i

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Quincey Morris
On Apr 2, 2015, at 04:54 , Charles Jenkins wrote: > Swift has a built-in func stringByTrimmingCharactersInSet(set: > NSCharacterSet) -> String There is something wacky going on here — or not. (I know you don’t want to use this particular method, but I’m just using it as an example.) First o

Another NSWindow Question

2015-04-02 Thread Dave
Hi, Is there a method similar in use to UIView’s layoutSubviews method? e.g a layoutWindow method. When the window is resized, I want to replace the Content View with a new one, is there a better way of doing this. This is a special case Overlay window that doesn’t have a Window Controller. A

Re: NSWindow Subclass close/dealloc question

2015-04-02 Thread Dave
> On 2 Apr 2015, at 17:09, Ken Thomases wrote: > > On Apr 2, 2015, at 10:56 AM, Dave wrote: > >> I’m getting a crash in dealloc in an NSWindow Subclass. > >> If I run this, then I get a crash when the autorelease pool is drained. >> However, if I take out the line: >> >> [super close]; >>

Re: NSWindow Subclass close/dealloc question

2015-04-02 Thread Ken Thomases
On Apr 2, 2015, at 10:56 AM, Dave wrote: > I’m getting a crash in dealloc in an NSWindow Subclass. > If I run this, then I get a crash when the autorelease pool is drained. > However, if I take out the line: > > [super close]; > > in my close method, all works fine. > > Is this expected? If

NSWindow Subclass close/dealloc question

2015-04-02 Thread Dave
Hi, I’m getting a crash in dealloc in an NSWindow Subclass. I have a class that creates and closes Windows based on Notifications received from elsewhere. One of the Notifications is “CloseWindow”. I added this to my subclass: -(void) close { LogIfDave(@"Overlay close"); [super close];

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Jens Alfke
> On Apr 2, 2015, at 4:54 AM, Charles Jenkins wrote: > > What would be nice is a way to count leading and trailing characters in place > while the thing is still an NSAttributedString--without using > NSAttributedString.string to convert to a Swift string in the first place. If > there were n

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Charles Jenkins
Oops. My documentation viewer was set up wrong. characterAtIndex() is indeed supposed to be available in Swift. Don’t know what I’ve done wrong that I can’t use it in a playground. --  Charles On April 2, 2015 at 10:18:00, Charles Jenkins (cejw...@gmail.com) wrote: The documentation certainly

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Charles Jenkins
The documentation certainly says that, Ken, but stick this code in a playground and see that you can’t examine the characters via index no matter whether you assume it to be String or NSString: let whitespaceSet = NSCharacterSet.whitespaceAndNewlineCharacterSet() let attrStr = NSAttributedString

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Ken Thomases
On Apr 2, 2015, at 6:54 AM, Charles Jenkins wrote: > What would be nice is a way to count leading and trailing characters in place > while the thing is still an NSAttributedString--without using > NSAttributedString.string to convert to a Swift string in the first place. NSAttributedString.str

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Uli Kusterer
On 02 Apr 2015, at 13:54, Charles Jenkins mailto:cejw...@gmail.com>> wrote: > What would be nice is a way to count leading and trailing characters in place > while the thing is still an NSAttributedString--without using > NSAttributedString.string to convert to a Swift string in the first place.

Re: Swift: How to determine if a Character represents whitespace?

2015-04-02 Thread Charles Jenkins
I kept my original question as brief as I could, but let me tell you what problem I’m trying to solve, and maybe someone will have good advice I haven’t yet considered. I’m trying to code in pure Swift. I have an NSAttributedString which can potentially be very large, and I want to save off the