Re: Instantiate NSString from NSURL in Swift

2015-02-23 Thread Charles Srstka
On Feb 23, 2015, at 1:52 PM, Fritz Anderson wrote: > > This is written in haste, and few people are experts… > >theURL.host may yield nil (host is declared String!, implicitly > unwrapped, but optional). > >theURL.host?.lowercaseString will short-circuit and be evaluated as nil > if

Re: Latest Documentation for adding Applescript Support to an Objective-C Project

2015-02-23 Thread Shane Stanley
On 24 Feb 2015, at 12:21 am, Dave wrote: > > From searching online it looks like things have changed quite recently? Not in terms of how it's implemented in apps. -- Shane Stanley ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do no

Re: NSOpenPanel() crash in Swift 1.1 -- SOLVED?

2015-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2015, at 04:08 PM, Bill Cheeseman wrote: > > > On Feb 23, 2015, at 5:02 PM, Charles Srstka > > wrote: > > > > That’s not a crash. That’s just some C++ code deep down in the system > > somewhere using exceptions as flow control. > > > It sure wasted a lot of my time, whatever

Re: NSOpenPanel() crash in Swift 1.1 -- SOLVED?

2015-02-23 Thread Bill Cheeseman
> On Feb 23, 2015, at 5:02 PM, Charles Srstka wrote: > > That’s not a crash. That’s just some C++ code deep down in the system > somewhere using exceptions as flow control. It sure wasted a lot of my time, whatever you want to call it. Extremely annoying. It's been so long since I used C++

Re: scale text proportionally as bounds increase

2015-02-23 Thread Jens Alfke
> On Feb 23, 2015, at 8:49 AM, sqwarqDev <2551p...@gmail.com> wrote: > > How do I programmatically tell each NSControl to increase its text size > proportionally as its bounds increase? You’ll have to do it manually. Observe the control’s frame, then when it changes compute a new font size and

Re: get class of a method's returned object

2015-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2015, at 03:45 PM, Kyle Sluder wrote: > On Mon, Feb 23, 2015, at 03:22 PM, BareFeetWare wrote: > > @interface NSObject (Private) > > - (NSString *) _shortMethodDescription; > > @end > > > > NSString *fullMethodList = [[self class] _shortMethodDescription]; > > > > which gives the

Re: NSOpenPanel() crash in Swift 1.1 -- SOLVED?

2015-02-23 Thread Charles Srstka
On Feb 23, 2015, at 3:51 PM, Bill Cheeseman wrote: > > The explanation I found via Google search was in a short article from Touch > Code Magazine, here: > http://www.touch-code-magazine.com/how-to-show-an-open-file-dialogue-in-cocoa/ > >

Re: NSOpenPanel() crash in Swift 1.1 -- SOLVED?

2015-02-23 Thread Bill Cheeseman
> On Feb 23, 2015, at 3:43 PM, Kyle Sluder wrote: > > On Mon, Feb 23, 2015, at 02:00 PM, Bill Cheeseman wrote: >> >> But I appear to have solved the problem, based on something I found by >> doing a broader Google search. At some point I had added a breakpoint for >> "All Exceptions." My latest

Re: Instantiate NSString from NSURL in Swift

2015-02-23 Thread Quincey Morris
On Feb 23, 2015, at 11:52 , Kyle Sluder wrote: > > So the type of > foo?.lowercaseString is String?. Yes, I agree, so the OP’s *original* error message was correct, but the question is what is the type of ‘foo?.lowercaseString!’, and that depends on the precedence of the “!” operator. The ac

Re: get class of a method's returned object

2015-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2015, at 03:22 PM, BareFeetWare wrote: > @interface NSObject (Private) > - (NSString *) _shortMethodDescription; > @end > > NSString *fullMethodList = [[self class] _shortMethodDescription]; > > which gives the full header breakdown of methods with parameters and > return classes.

Re: get class of a method's returned object

2015-02-23 Thread BareFeetWare
Thank you all for your replies and for the clarification on my question. I have tweaked the subject of this email to hopefully avoid future confusion. That is disappointing that we can't seem to get the class of the returned object. It seems like a major omission. I wonder, then, how the _short

Re: NSOpenPanel() crash in Swift 1.1 -- SOLVED?

2015-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2015, at 02:00 PM, Bill Cheeseman wrote: > > But I appear to have solved the problem, based on something I found by > doing a broader Google search. At some point I had added a breakpoint for > "All Exceptions." My latest Google search turned up a suggestion to limit > this to "Obj

Re: NSOpenPanel() crash in Swift 1.1 -- SOLVED?

2015-02-23 Thread Bill Cheeseman
> On Feb 20, 2015, at 7:45 AM, Bill Cheeseman wrote: > > I'm writing a single-window utility application in Xcode 6.1.1 on OS X > 10.10.2 using Swift 1.1. This code statement crashes: > > let panel = NSOpenPanel() > > For the first several days after I added this statement, it worked cor

Re: Instantiate NSString from NSURL in Swift

2015-02-23 Thread Fritz Anderson
On 23 Feb 2015, at 8:18 AM, Juanjo Conti wrote: > > I'm translating some code from Objective-C to Swift and in the middle of > that, i found this problem. > > theUrl is an instance of NSURL > > theUrl.host?.lowercaseString > > compiles ok. > > But > > NSString(string: theUrl.host?.lowercaseS

Re: Instantiate NSString from NSURL in Swift

2015-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2015, at 01:48 PM, Marco S Hyman wrote: > lowerCaseString is a non optional property. Therefore it makes no sense > to > write someString.lowercaseString? or someString.lowercaseString! It's chained through an optional access though. So the type of foo?.lowercaseString is String?.

Re: get class of a method

2015-02-23 Thread Alex Zavatone
In that case, all I can think of is parsing all the project the .m files, finding the method implementation and storing what string is declared within the parens. Build the table before compilation or at, store it in plists for each class and read the plist for each class to determine the expec

Re: get class of a method

2015-02-23 Thread Alex Zavatone
I'm surely speaking from ignorance here, but could one extend the runtime to store a table (NSSet?) of class methods and then at an appropriate event, either parse all the source (lame, I know) or access a class method table from the runtime? Check out "Name angling in Objective-C" on Wikipedia

How to translate this form objc to swift? (__unsafe_unretained)

2015-02-23 Thread Juanjo Conti
NSUInteger count = [headers count]; __unsafe_unretained id keys[count], values[count]; [headers getObjects:values andKeys:keys]; for (NSUInteger i=0;ihttp://goog_2023646312>@carouselapps.com > Software Engineer - Carousel Apps -- Carousel Apps Limited

Instantiate NSString from NSURL in Swift

2015-02-23 Thread Juanjo Conti
Hi! I'm translating some code from Objective-C to Swift and in the middle of that, i found this problem. theUrl is an instance of NSURL theUrl.host?.lowercaseString compiles ok. But NSString(string: theUrl.host?.lowercaseString) don't. It says "Value of optional type 'String?' no unwrapped; d

Latest Documentation for adding Applescript Support to an Objective-C Project

2015-02-23 Thread Dave
Hi, I’m a bit confused as to where the latest documentation and sample code for adding Applescript support to an Objective-C Project. From searching online it looks like things have changed quite recently? When I downloaded the Sample AS App’s from the Apple Developer Site, I got a warning tell

Re: Color fun with IBOutlet named "appNameLabel"

2015-02-23 Thread Markus Spoettl
Hi Graham, On 23/02/15 00:18, Graham Cox wrote: Are you certain they're set up identically? I noticed a similar thing recently with some labels coming up black and others responding to a change in highlighting (these were part of a view-based table row) by changing to white. I thought all of my