Best method for showing & hiding an inspector nspanel

2016-09-11 Thread mail...@ericgorr.net
I have a sample git project here: https://github.com/ericgorr/nspanel_show

I am working on a swift, core data, and storyboard application.

If it matters, I am using the latest official version of Xcode and OS X.

I can easily show the nspanel by creating a button a called “Show Panel Segue” 
and creating a Show Segue between the button and the Panel Scene. However, I 
get a new panel window every time I press the button. Is there a way to limit 
it to just a single instance? Is using a segue to show the panel the best 
method? If not, what is recommended?

For a storyboard application, what then is the recommended way to hide the 
inspector nspanel?




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: referencing a Swift Dictionary from Objective-C

2016-09-11 Thread Gavin Eadie

> On Sep 11, 2016, at 1:31 AM, Charles Srstka  wrote:
> 
>> On Sep 11, 2016, at 12:16 AM, Gavin Eadie  wrote:
>> 
>> I’m moving some code from Obj-C to Swift and, from time to time, I open a 
>> gap I cannot see across.  This is one, and I’d love some assistance.
>> 
>> I converted a pile of utility Obj-C code that included a class method of the 
>> form on the rhs of:
>> 
>>  xxx = [UIColor colorFromName:@"aliceblue"]
>> 
>> In the new Swift replacement of the utility code, I added a global constant 
>> Dictionary of the form:
>> 
>>  public let colorLookup = [
>> "aliceblue" : UIColor.init(colorLiteralRed:0.0, green:0.5, blue:1.0, 
>> alpha:1.0),
>> …
>>  ]
>> 
>> and changed the Obj-C call to
>> 
>>  xxx = colorLookup[@"aliceblue"]
>> 
>> 
>> The Obj-C compiler complains that the subscript is not numeric.  It also 
>> appears to not be able to resolve the global constant "colorLookup" (which 
>> probably explains the error in the previous sentence).  I notice that 
>> "colorLookup" doesn’t appear in "Utilities-Swift.h" ..
>> 
>> There are other (and better) ways I could code this, but I’m curious why 
>> "colorLookup" is invisible to Objective-C .. Thanks, Gavin
> 
> Wrap the variable in an Objective-C class and it should be fine:
> 
> public class Constants: NSObject {
>   public let colorLookup: [String : UIColor] = ...
> }
> 
> Charles

.. nearly!  We just need "static" on the property:

class Constants: NSObject {
static let colorLookup: [String : UIColor] = ...
}

.. thanks, Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Progress Indicator

2016-09-11 Thread Peter Hudson
Hi Alex

I have moved the point where I start the progress indicator and, without 
getting into threading, its working again.

Many thanks

Peter




> On 10 Sep 2016, at 21:02, Alex Zavatone  wrote:
> 
> Is it that the animation thread is being blocked or the thread you have to 
> dispatch the request to start?
> 
> On Sep 10, 2016, at 10:16 AM, Peter Hudson wrote:
> 
>> Hi Steve
>> 
>> I think your suggestion is going the right way.
>> 
>> I have ( unwittingly ) moved the processing about and the calls to the 
>> progress indicator are now happening while the thread is blocked for 
>> processing ( and non of the interface is being updated until the processing 
>> is done )
>> 
>> Next question, I guess, is how do I get out of this corner ?
>> 
>> Peter
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>> 
>> This email sent to z...@mac.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com