Re: Multiple Inheritance via protocol extensions in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 23:26 , Gerriet M. Denkmann wrote: > > Anything to be done here? Or should I just forget about protocol extensions? There’s nothing really wrong here, it’s just that it doesn’t work like you think. There is no *inheritance* of protocol default implementations, which means t

Multiple Inheritance via protocol extensions in Swift

2016-09-06 Thread Gerriet M. Denkmann
Trying to eliminate code duplication I tried to use protocol extensions. But I ran into a rather grave problem. This probably is “working as documented”. But it surely it is not working like I hoped it would. Here is a Playground example: protocol Number { func aFunction() -> Int } exte

Re: Security-scoped bookmarks, what's going on?

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 22:44 , Graham Cox wrote: > > I still get the console messages: > > 2016-09-07 15:34:53.684 MyApp[9226:1630740] CFStringRef > __CFPasteboardIssueSandboxExtensionForPath(CFStringRef) : sandbox extension > creation failed: client lacks entitlements? for path: > [/Users/graham

Re: Security-scoped bookmarks, what's going on?

2016-09-06 Thread Graham Cox
> On 7 Sep 2016, at 2:12 PM, Quincey Morris > wrote: > > In other words, don’t create the bookmark data every time in > ‘encodeWithCoder’. Instead, create it once when you first get the URL from > NSOpen/SavePanel, store it as a property, and archive that NSData object. Ah, that makes (some

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 11:42, Quincey Morris > wrote: > > On Sep 6, 2016, at 21:31 , Gerriet M. Denkmann wrote: >> >> My Swift book (2.2) has no mention of “private” (Swift 3 beta has). > > It’s in the 2.2 book under “Language Guide” section “Access Control” You are right. I used Books.app on

Re: Init in Swift

2016-09-06 Thread Marco S Hyman
> > My Swift book (2.2) has no mention of “private” (Swift 3 beta has). > But even assuming I had Swift 3, I do not quite understand how this should be > done (I may be a bit dense). Page 508 in the Swift 2.2 book I just downloaded from iBooks. “Getters and Setters Getters and setters for const

Re: Init in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 21:31 , Gerriet M. Denkmann wrote: > > My Swift book (2.2) has no mention of “private” (Swift 3 beta has). It’s in the 2.2 book under “Language Guide” section “Access Control" > But even assuming I had Swift 3, I do not quite understand how this should be > done (I may be a

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 11:28, Quincey Morris > wrote: > > On Sep 6, 2016, at 21:14 , Gerriet M. Denkmann wrote: >> >> But I cannot get this to work. > > Meaning … ?? A compiler error? What does the source code look like, of the > protocol with the class func in it? What is the error message?

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 10:49, Quincey Morris > wrote: > > On Sep 6, 2016, at 17:17 , Gerriet M. Denkmann wrote: >> >> But what to do about localConstantDependingOnSuper? […] > Anyway, this particular example is fairly easily solved by declaring > “localConstantDependingOnSuper” as ‘private(set)

Re: Init in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 21:14 , Gerriet M. Denkmann wrote: > > But I cannot get this to work. Meaning … ?? A compiler error? What does the source code look like, of the protocol with the class func in it? What is the error message? > NewSuper uses this classFunction like: > func otherFunction( arg:

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 10:49, Quincey Morris > wrote: > >> Another problem: >> Super → SubA and SubB. >> SubA → SubA1 and SubA2 >> SubB → SubB1 and SubB2 >> >> Both SubA1 and SubB1 have identical functions. As have SubA2 and SubB2. >> Multiple inheritance would be a solution here; but neither Ob

Re: Security-scoped bookmarks, what's going on?

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 20:59 , Graham Cox wrote: > > I’m having trouble with security-scoped bookmarks in a sandboxed app. My understanding of security-scoped bookmarks (meaning: this used to be true ~2 years ago, but I haven’t tried recently to see if it’s still true) is that it’s not legal to re

Security-scoped bookmarks, what's going on?

2016-09-06 Thread Graham Cox
Hi all, I’m having trouble with security-scoped bookmarks in a sandboxed app. I have an object which has a URL as a property, being a folder the user chooses to save stuff to. This object is persistent, due to NSCoding. When I archive the URL, I use a security-scoped bookmark to save the data.

Re: Init in Swift

2016-09-06 Thread Quincey Morris
On Sep 6, 2016, at 17:17 , Gerriet M. Denkmann wrote: > > But what to do about localConstantDependingOnSuper? Now you’re moving the goal posts. :) I said: > assuming the places of definition aren’t more complicated than in your code and you’re making it more complicated. Anyway, this particula

Re: slicing in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 7 Sep 2016, at 07:55, Jonathan Hull wrote: > > I realized my comment may not have been clear. Probably clear enough. > Here is the actual code (written in Mail): > > var numbers: [UInt64] = … > > func numbers( upTo nbr: Int ) -> [UInt64] > { > return Array( numbers[

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-06 Thread Frank D. Engel, Jr.
The limitation of this approach is that if the proxy settings change, the daemon will be out of sync and you would need to rerun the installer (or some sort of "Fix Proxy Settings Utility") to bring it up to date. On 9/5/2016 15:10, Jens Alfke wrote: One other possibility is: * Installer gets

Re: slicing in Swift

2016-09-06 Thread Jonathan Hull
I realized my comment may not have been clear. Here is the actual code (written in Mail): var numbers: [UInt64] = … func numbers( upTo nbr: Int ) -> [UInt64] { return Array( numbers[ 0 ..< nbr ] ) } Thanks, Jon > On Sep 6, 2016, at 5:42 PM, Jonathan Hull wrote: > > Yo

Re: slicing in Swift

2016-09-06 Thread Marco S Hyman
> On Sep 6, 2016, at 5:33 PM, Gerriet M. Denkmann wrote: > > var numbers: [UInt64] = … > > func numbers( upTo nbr: Int ) -> [UInt64] > { > let slice = numbers[ 0 ..< nbr ] > return slice > // Cannot convert return expression of type ‘ArraySlice' > to retur

Re: slicing in Swift

2016-09-06 Thread Jonathan Hull
You can explicitly create an array with the slice by using ‘Array(slice)’. Honestly, I am not sure of the actual value of slices because of issues like this. I would rather have those methods return an Array which is some sort of copy on write slice internally. Thanks, Jon > On Sep 6, 2016,

slicing in Swift

2016-09-06 Thread Gerriet M. Denkmann
var numbers: [UInt64] = … func numbers( upTo nbr: Int ) -> [UInt64] { let slice = numbers[ 0 ..< nbr ] return slice // Cannot convert return expression of type ‘ArraySlice' to return type '[UInt64]' // workaound: var outCopy:[UI

Re: Init in Swift

2016-09-06 Thread Greg Parker
> On Sep 6, 2016, at 5:17 PM, Gerriet M. Denkmann wrote: > >> On 5 Sep 2016, at 13:29, Quincey Morris >> wrote: >> >> More globally, this sort of thing is not terribly idiomatic for Swift, >> because you’re trying to hide things that could get exposed other ways, for >> example, by “hostile

Re: Init in Swift

2016-09-06 Thread Gerriet M. Denkmann
> On 5 Sep 2016, at 13:29, Quincey Morris > wrote: > > On Sep 4, 2016, at 22:50 , Gerriet M. Denkmann wrote: > > If you can’t do that, you can do it with a closure, assuming the places of > definition aren’t more complicated than in your code. Something like this: > >> class SuperClass >> {

Unusual Conditional Formatting

2016-09-06 Thread Frank D. Engel, Jr.
I am trying to set up what is apparently a somewhat unusual behavior: I have a formatter which I want to behave differently depending on an attribute of the value coming in, and on a user preference that can be toggled in the preference panel. Basically, they are all floating-point values, bu

Re: How to set up my NSViews?

2016-09-06 Thread Ken Thomases
On Sep 6, 2016, at 1:38 PM, Andreas Falkenhahn wrote: > > On 06.09.2016 at 18:51 Ken Thomases wrote: > >> On Sep 6, 2016, at 11:41 AM, Andreas Falkenhahn >> wrote: > >>> My NSWindow contains an NSView which I use to draw custom graphics to. It >>> doesn't >>> contain any widgets like buttons

Re: How to set up my NSViews?

2016-09-06 Thread Kyle Sluder
On Tue, Sep 6, 2016, at 01:38 PM, Andreas Falkenhahn wrote: > On 06.09.2016 at 18:51 Ken Thomases wrote: > > > On Sep 6, 2016, at 11:41 AM, Andreas Falkenhahn > > wrote: > > >> My NSWindow contains an NSView which I use to draw custom graphics to. It > >> doesn't > >> contain any widgets like

Re: How to set up my NSViews?

2016-09-06 Thread Andreas Falkenhahn
On 06.09.2016 at 18:51 Ken Thomases wrote: > On Sep 6, 2016, at 11:41 AM, Andreas Falkenhahn > wrote: >> My NSWindow contains an NSView which I use to draw custom graphics to. It >> doesn't >> contain any widgets like buttons at all, just custom graphics drawn in >> drawRect(). >> Now I'd li

Re: How to set up my NSViews?

2016-09-06 Thread Richard Charles
Use AVPlayerLayer which is a subclass of CALayer. Set your parent NSView as a layer backed view or as a layer hosting view. This process can be a little confusing. Refer to Setting Up Layer Objects. https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CoreAnimation_guide/Setti

Re: How to set up my NSViews?

2016-09-06 Thread Ken Thomases
On Sep 6, 2016, at 11:41 AM, Andreas Falkenhahn wrote: > > My NSWindow contains an NSView which I use to draw custom graphics to. It > doesn't > contain any widgets like buttons at all, just custom graphics drawn in > drawRect(). > > Now I'd like to have an AVPlayerView NSView on top of this v

How to set up my NSViews?

2016-09-06 Thread Andreas Falkenhahn
My NSWindow contains an NSView which I use to draw custom graphics to. It doesn't contain any widgets like buttons at all, just custom graphics drawn in drawRect(). Now I'd like to have an AVPlayerView NSView on top of this view. Thus, I tried to add this AVPlayerView on top of the NSView by do

Re: AVPlayerView just shows static QuickTime image

2016-09-06 Thread Andreas Falkenhahn
Ok, I don't know why but AV Foundation seems to reject this *.mov file generally. I tried to play it using the "AVSimplePlayer" example code obtained from here https://developer.apple.com/library/mac/technotes/tn2300/_index.html and it says "Asset is not playable". When trying to play it using th

AVPlayerView just shows static QuickTime image

2016-09-06 Thread Andreas Falkenhahn
I'm trying to get an AVPlayerView to play a *.mov file stored locally on HD but all I get is a static QuickTime image with control buttons and a seek bar. The sound plays fine but there is no video! Here is a screenshot: http://i63.tinypic.com/2rp8rd0.png How can this be? The class looks like th

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-06 Thread Ken Thomases
On Sep 6, 2016, at 7:36 AM, Motti Shneor wrote: > > I doubt all Apple preinstalled applications have free access to any keychain > content (passwords), or else any Apple application would serve as a potential > vulnerability and the whole point of encrypted key-chains wouldn’t worth > much. I

Re: How to silently use Proxy authentication credentials from Keychain, like Safari, Mail, etc.

2016-09-06 Thread Motti Shneor
Hello Jens, and thanks. I doubt all Apple preinstalled applications have free access to any keychain content (passwords), or else any Apple application would serve as a potential vulnerability and the whole point of encrypted key-chains wouldn’t worth much. I think there is some kind of trust,

Re: Limiting app installation

2016-09-06 Thread Charles Jenkins
They don’t allow it. It’s a specific promise of the app store that you pay once and then you can load the app on all your compatible devices. On Mon, Sep 5, 2016 at 2:44 PM, Rick Mann wrote: > Does Apple allow a developer to limit the number of devices on which an > app can run? I have an app th

Re: Window Opened Notification?

2016-09-06 Thread じょいすじょん
> On 2016 Sep 6, at 18:49, Dave wrote: > >> >> Ah. >> Well in that case, you get accessibility and you need users to allow it >> once. > > I said in my original post - without using Accessibility > > Cheers > Dave I know. I remember. Point is, the AX API is your only realistic option to

Re: Window Opened Notification?

2016-09-06 Thread Dave
> On 6 Sep 2016, at 10:37, dangerwillrobinsondan...@gmail.com wrote: > > Ah. > Well in that case, you get accessibility and you need users to allow it once. I said in my original post - without using Accessibility Cheers Dave >> On Sep 6, 2016, at 5:49 PM, Dave wrote: >> >> Hi, >> T

Re: Window Opened Notification?

2016-09-06 Thread dangerwillrobinsondanger
Ah. Well in that case, you get accessibility and you need users to allow it once. Sent from my iPhone > On Sep 6, 2016, at 5:49 PM, Dave wrote: > > Hi, > >>> The two key properties in NSWorkspace > > I saw these properties but I don’t think they will do what I want since > frontmostApplic

Re: Window Opened Notification?

2016-09-06 Thread Dave
Hi, >> The two key properties in NSWorkspace I saw these properties but I don’t think they will do what I want since frontmostApplication and menuBarOwningApplication refer to an Application not a Window within an Application. For instance: Launch Text Edit Empty Window Opens