Segue from a toolbar item and prepareForSegue

2014-10-19 Thread Rick Mann
(NB: This is a pure-Swift app, but I don't think that matters here). OS X Storyboard app. I set up a toolbar item with a sheet segue to a view controller. Works fine, but I can't find an appropriate place to put the prepareForSegue() call. The toolbar lives in the window, so I subclassed

Re: Segue from a toolbar item and prepareForSegue

2014-10-19 Thread Rick Mann
I figured it out. I wasn't able to use override when defining my prepareForSegue(), because I renamed the sender: parameter to inSender, not realizing it needed the sender ahead of it. The example code from Apple only had sender: AnyObject?. It was very confusing, because online and in the

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Roland King
On 19 Oct 2014, at 11:42 am, Rick Mann rm...@latencyzero.com wrote: On Oct 18, 2014, at 20:33 , Graham Cox graham@bigpond.com wrote: According to the latest documentation pack that arrived on Thursday, Swift has: convenience init(windowNibName windowNibName: String,

Re: Segue from a toolbar item and prepareForSegue

2014-10-19 Thread Roland King
On 19 Oct 2014, at 2:33 pm, Rick Mann rm...@latencyzero.com wrote: Also, the background process that handles code completion keeps crashing, so my code completion was totally borked. Although, the first time it did work, it put in the override, but failed to put in the named second

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Rick Mann
On Oct 18, 2014, at 23:38 , Roland King r...@rols.org wrote: The very first of those errors looks like you had the code in the wrong place, ie not within your class. Initialization is one of those Swift things which is uber-safe and thus very structured and hence in practice

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Quincey Morris
On Oct 18, 2014, at 23:46 , Rick Mann rm...@latencyzero.com wrote: The rules on initializers don't make sense to me, in all honesty. Yes, but that tells us more about you than about Swift — specifically, it tells us that you’re more focused on what would ease your coding task in this one

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Rick Mann
On Oct 19, 2014, at 00:19 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Oct 18, 2014, at 23:46 , Rick Mann rm...@latencyzero.com wrote: The rules on initializers don't make sense to me, in all honesty. Yes, but that tells us more about you than about Swift —

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Quincey Morris
On Oct 19, 2014, at 00:24 , Rick Mann rm...@latencyzero.com wrote: Well, I'm not sure I agree with that. Every initializer in a class should work correctly. If, hypothetically, a subclass was allowed to call any initializer in the superclass, then the result would be an object that was

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Rick Mann
On Oct 19, 2014, at 00:54 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: If, hypothetically, a subclass was allowed to call any initializer in the superclass, then the result would be an object that was fully (“correctly”) initialized in terms of the superclass, but that

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Roland King
(It’s all about the “yes, but”s.) … calling *up* from a subclass convenience initializer bypasses all of the subclass designated initializers (except in the case that the subclass overrides some or all of the superclass's, which introduces its own semantic ambiguities). That means that

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Quincey Morris
On Oct 19, 2014, at 00:56 , Rick Mann rm...@latencyzero.com wrote: The subclass initializer still has to initialize itself. It knows what the superclass initializer is doing, and it knows what it still needs to do. That's true even with the rules Swift currently imposes. I don’t actually

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Rick Mann
On Oct 19, 2014, at 01:19 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: In short, take the “override” keyword off your declaration, and it should work exactly as you expected. (!) I don't remember now, but I think it complained that I was overriding an inherited method.

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Quincey Morris
On Oct 19, 2014, at 01:20 , Rick Mann rm...@latencyzero.com wrote: I don't remember now, but I think it complained that I was overriding an inherited method. Well, double-checking the syntax earlier in the chapter, you will need to declare it “convenience”.

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Rick Mann
On Oct 19, 2014, at 01:27 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: On Oct 19, 2014, at 01:20 , Rick Mann rm...@latencyzero.com wrote: I don't remember now, but I think it complained that I was overriding an inherited method. Well, double-checking the syntax

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Quincey Morris
On Oct 19, 2014, at 01:28 , Rick Mann rm...@latencyzero.com wrote: you will need to declare it “convenience”. Tried that, too. Ugh! Now you made me create a project to try it. It looks like the problem is that ‘init’ is already a designated initializer, though not of NSWindowController.

Re: Subclassing NSWindowController in Swift

2014-10-19 Thread Rick Mann
On Oct 19, 2014, at 02:14 , Quincey Morris quinceymor...@rivergatesoftware.com wrote: Ugh! Now you made me create a project to try it. Heh. Let's try this: Swift sucks; it can't make a million dollars appear on my doorstep. Or maybe someone else has a better solution. Yeah. Load my nib

Re: One more Document app style question

2014-10-19 Thread Mike Abdullah
On 18 Oct 2014, at 17:19, Luther Baker lutherba...@gmail.com wrote: Coming from an iOS background, I'm used to seeing (and encapsulating) the creation of key Core Data components (persistent store, location, contexts). Everything is pretty explicit and consequently easy to follow. When I

Trouble binding an NSTextField value in Swift

2014-10-19 Thread Rick Mann
I have a Swift ViewController that has an NSTextField, and a property var port: Port?. Port is an Objective-C class. The text field's value is bound to port.name. Unfortunately, setting port seems to have no effect on the label. I can bind the label to other things (like the view controller's

Re: bundleForClass in Swift

2014-10-19 Thread Kevin Meaney
I think my other reply will make this a moot point, but since [NSBundle bundleForClass:] takes a Class, and you know what your class is, just pass it that, you don't have to reference self. [NSBundle bundleForClass:[MyGroovySubclass class]]; Sorry, I was conflating Obj-C and Swift

Wiring up MainMenu.xib

2014-10-19 Thread Luther Baker
I created a Document based app and Xcode created two XIB - MainMenu.xib and Document.xib. Per the online docs for subclassing NSWindowController, I created my own NSWindowController subclass and set that as the File's Owner for the Document.xib and so far, everything has worked fine. Now, I added

Re: Wiring up MainMenu.xib

2014-10-19 Thread Scott Ribe
You don't need to wire that up in IB. You just need to implement the action in your window controller. On Oct 19, 2014, at 8:36 AM, Luther Baker lutherba...@gmail.com wrote: I created a Document based app and Xcode created two XIB - MainMenu.xib and Document.xib. Per the online docs for

Re: Wiring up MainMenu.xib

2014-10-19 Thread Scott Ribe
Sorry, duh, you wire it up to First Responder. On Oct 19, 2014, at 8:47 AM, Scott Ribe scott_r...@elevated-dev.com wrote: You don't need to wire that up in IB. You just need to implement the action in your window controller. On Oct 19, 2014, at 8:36 AM, Luther Baker lutherba...@gmail.com

Re: Wiring up MainMenu.xib

2014-10-19 Thread Luther Baker
I see ... the old First Responder Proxy trick :-) Thanks Scott, -Luther On Sun, Oct 19, 2014 at 9:50 AM, Scott Ribe scott_r...@elevated-dev.com wrote: Sorry, duh, you wire it up to First Responder. On Oct 19, 2014, at 8:47 AM, Scott Ribe scott_r...@elevated-dev.com wrote: You don't need

WWDC App

2014-10-19 Thread Gordon Apple
What has happened to the WWDC app? I even deleted it from my iPad and re-downloaded it. It doesn¹t work. Crashes and quits when you select anything. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

How do I show application-specific data on a web page?

2014-10-19 Thread Daryle Walker
I dabbled with writing web pages in the Mosaic days (i.e. the mid-1990s), but I’ve never done anything with Java or JavaScript. For my web browser project, I sometimes want to show synthesized pages. It would be a web page within my bundle that I have to modify before displaying. I first

Re: WWDC App

2014-10-19 Thread iain
It's started crashing since iOS8 but a trick is to long press the video you want and select Watch Video from the popup then it'll play ok Iain On 19 Oct 2014, at 6:40 pm, Gordon Apple g...@ed4u.com wrote: What has happened to the WWDC app? I even deleted it from my iPad and re-downloaded

Re: How do I show application-specific data on a web page?

2014-10-19 Thread Ben Kennedy
On 19 Oct 2014, at 11:07 am, Daryle Walker dary...@mac.com wrote: For my web browser project, I sometimes want to show synthesized pages. It would be a web page within my bundle that I have to modify before displaying. I recommend you take a look at GRMustache [1] or something similar; it

Re: WWDC App

2014-10-19 Thread Alex Zavatone
I'm betting when Apple changed their links to the Xcode docs that broke Documentation for 3 days, that some of the links to content that the app used also broke, resulting in a brokey app. That's my guess. On Oct 19, 2014, at 1:40 PM, Gordon Apple wrote: What has happened to the WWDC app? I

Re: WWDC App

2014-10-19 Thread Roland King
Broke all the way back at Beta 4, I filed a bug on it at the time, duped and still open. On 20 Oct 2014, at 2:15 am, iain i...@falsevictories.com wrote: It's started crashing since iOS8 but a trick is to long press the video you want and select Watch Video from the popup then it'll play

Re: WWDC App

2014-10-19 Thread Roland King
On 20 Oct 2014, at 3:07 am, Alex Zavatone z...@mac.com wrote: I'm betting when Apple changed their links to the Xcode docs that broke Documentation for 3 days, that some of the links to content that the app used also broke, resulting in a brokey app. That's my guess. Wrong guess.

Re: WWDC App

2014-10-19 Thread Alex Zavatone
That's why I stopped reporting bugs. On Oct 19, 2014, at 6:18 PM, Roland King wrote: Broke all the way back at Beta 4, I filed a bug on it at the time, duped and still open. On 20 Oct 2014, at 2:15 am, iain i...@falsevictories.com wrote: It's started crashing since iOS8 but a trick is

Re: Wiring up MainMenu.xib

2014-10-19 Thread Graham Cox
On 20 Oct 2014, at 1:51 am, Luther Baker lutherba...@gmail.com wrote: I see ... the old First Responder Proxy trick :-) Maybe you're joking, but, well, that's not a trick. It's a key part of Cocoa design. If you have an app where the responder changes dynamically - which is usually the

Re: Wiring up MainMenu.xib

2014-10-19 Thread Luther Baker
On Oct 19, 2014, at 7:20 PM, Graham Cox graham@bigpond.com wrote: ... Maybe you're joking, but, well, that's not a trick. It's a key part of Cocoa design. Good catch. I called it a trick as it surprised me that it worked as such. Indeed, I did not really understand why it worked nor