Re: access modifiers in protocols

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 22:37 , Roland King  wrote:
> 
> No - can’t have a stored property in an extension

(Someone just asked basically the same question in the dev forums, but with a 
different example. Was that you?)

The following compiles for me without error:

> public protocol Foo {
>   mutating func foo( Int )->Void
> }
> 
> extension Foo {
>   internal mutating func fooInternal( Int )->Void {}
>   public mutating func foo( i: Int )->Void { fooInternal (i)}
> }
> 
> internal protocol FooInternal: Foo {
>   mutating func fooInternal( Int )->Void
> }
> 
> internal protocol FooArray: FooInternal {
>   var bar : Array { get set }
> }
> 
> extension FooArray {
>   mutating func fooInternal( i: Int )->Void { bar.append( i )}
> }
> 
> public struct AFoo: Foo {
>   public mutating func foo( Int )->Void { print ("cheers")}
> }
> 
> public struct BFoo: Foo, FooArray {
>   var bar : Array = []
> }

I’m not absolutely sure it does what you want, and if it does I’m not sure it’s 
the shortest possible sequence. But it compiles without error.



___

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: access modifiers in protocols

2015-06-16 Thread Roland King

> On 17 Jun 2015, at 13:33, Quincey Morris 
>  wrote:
> 
> On Jun 16, 2015, at 22:24 , Roland King  > wrote:
>> 
>> 1) making FooImplementedWithArray internal downgrades the foo() function to 
>> internal within that protocol, no longer is it public (this is made explicit 
>> by a compiler warning which tells you you’re implementing an internal 
>> function as public if you try doing it) 
>> 2) anything implementing FooImplementedWithArray can at *most* be internal, 
>> you can’t have a public class implement an internal protocol
> 
> What about this:
> 
>>  public protocol Foo
>>  {
>>  mutating func foo( Int )->Void
>>  }
>> 
>>  public protocol FooImplementedWithArray : Foo
>>  {
>>  }
>> 
>>  extension FooImplementedWithArray
>>  {
>>  var bar = Array ()
>>  public mutating func foo( i : Int ) -> Void { bar.append( i ) }
>>  }
> 
> Then Foo’s that don’t use a bar array will provide their own implementation, 
> and FooImplementedWithArray’s will default to the extension’s empty array, or 
> they can override bar with some other implementation. At least, that’s what 
> it looks like to me. :)
> 
> Sorry if you said that already. In your explanation, I can’t seem to separate 
> what you want from what you’ve tried.
> 

No - can’t have a stored property in an extension

var bar = Array()  // <— nope


___

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: access modifiers in protocols

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 22:24 , Roland King  wrote:
> 
> 1) making FooImplementedWithArray internal downgrades the foo() function to 
> internal within that protocol, no longer is it public (this is made explicit 
> by a compiler warning which tells you you’re implementing an internal 
> function as public if you try doing it) 
> 2) anything implementing FooImplementedWithArray can at *most* be internal, 
> you can’t have a public class implement an internal protocol

What about this:

>   public protocol Foo
>   {
>   mutating func foo( Int )->Void
>   }
> 
>   public protocol FooImplementedWithArray : Foo
>   {
>   }
> 
>   extension FooImplementedWithArray
>   {
>   var bar = Array ()
>   public mutating func foo( i : Int ) -> Void { bar.append( i ) }
>   }

Then Foo’s that don’t use a bar array will provide their own implementation, 
and FooImplementedWithArray’s will default to the extension’s empty array, or 
they can override bar with some other implementation. At least, that’s what it 
looks like to me. :)

Sorry if you said that already. In your explanation, I can’t seem to separate 
what you want from what you’ve tried.



___

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: access modifiers in protocols

2015-06-16 Thread Roland King

> On 17 Jun 2015, at 13:15, Quincey Morris 
>  wrote:
> 
> The rest of your explanations is TMI, I can’t wrap my brain around it, but 
> why can’t you do this:
> 
>>  public protocol Foo
>>  {
>>  mutating func foo( Int )->Void
>>  }
>> 
>>  internal protocol FooImplementedWithArray : Foo
>>  {
>>  var bar : Array { get set }
>>  }
>> 
>>  extension FooImplementedWithArray
>>  {
>>  public mutating func foo( i : Int ) -> Void { bar.append( i ) }
>>  }
> 
> and have individual types conform to Foo or FooImplementedWithArray, 
> depending on which default implementation you want?
> 

Two reasons, which were in the chunk of text which was TL;DR (couldn’t make it 
shorter), I tried this and lots of other things

1) making FooImplementedWithArray internal downgrades the foo() function to 
internal within that protocol, no longer is it public (this is made explicit by 
a compiler warning which tells you you’re implementing an internal function as 
public if you try doing it) 
2) anything implementing FooImplementedWithArray can at *most* be internal, you 
can’t have a public class implement an internal protocol

So that doesn’t give me what I need. 
___

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: access modifiers in protocols

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 21:58 , Roland King  wrote:
> 
> Is there a good linguistic reason why access modifiers which restrict access 
> should not be allowed in protocols? I mean something like this
> 
>   public protocol Foo
>   {
>   mutating func foo( Int )->Void
>   internal var bar : Array { get set }   // <- 
> can’t do this
>   }

It seems to me that “public” here means “all these methods are the public API 
of types conforming to Foo". Therefore, it wouldn’t make sense to specify any 
access controls on individual properties/methods.

The rest of your explanations is TMI, I can’t wrap my brain around it, but why 
can’t you do this:

>   public protocol Foo
>   {
>   mutating func foo( Int )->Void
>   }
> 
>   internal protocol FooImplementedWithArray : Foo
>   {
>   var bar : Array { get set }
>   }
> 
>   extension FooImplementedWithArray
>   {
>   public mutating func foo( i : Int ) -> Void { bar.append( i ) }
>   }

and have individual types conform to Foo or FooImplementedWithArray, depending 
on which default implementation you want?

The other aspect is that there’s a difference between just having a default 
implementation in a protocol and extension, and having that *plus* a constraint 
specifying the same property/method in the original protocol. This was touched 
on briefly, late in the POP video, but it went by so fast I didn’t get to think 
about the implications for scenarios like the one you’re considering.



___

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

access modifiers in protocols

2015-06-16 Thread Roland King
Is there a good linguistic reason why access modifiers which restrict access 
should not be allowed in protocols? I mean something like this

public protocol Foo
{
mutating func foo( Int )->Void
internal var bar : Array { get set }   // <- 
can’t do this
}

What do I think this would mean? I mean by it that a Type conforming to Foo 
must be public, and must have a public function foo and an internal variable 
bar. 

Why would I want to do this? What I was trying to do is use protocol extensions 
to provide a default implementation of a protocol method, one which requires a 
backing property. So the code I really wanted to write was this

public protocol Foo
{
mutating func foo( Int ) -> Void
}

That’s my public definition of the Foo protocol, I don’t care how it’s 
implemented. Let’s say however that a very usual implementation of foo() would 
use an Array property like this

public struct FooImpl : Foo
{
internal var bar = Array()
public mutating func foo( i : Int ) -> Void { bar.append( i ) }
}

But I have lots of Types which want to implement Foo and although I don’t want 
to have to copy the method body of foo() everywhere, it might be a little 
longer in real life. or perhaps Foo has 10 different methods

I could use my FooImpl in all those Types by composition, but then for each 
method in Foo I have to explicitly call the implementer version. If there’s 
many methods, that’s repeated code in every Type. 

public struct AnotherFooImpl : Foo
{
internal var fooImplementer = FooImpl()
public mutating func foo( i : Int ) -> Void { 
fooImplementer.foo( i ) ) // do this for each method in Foo
}

What I’d like is for the compiler to do this for me with a protocol extension, 
I can do this like so by extending Foo like this and using an extension

public protocol FooImplementedWithArray : Foo
{
var bar : Array { get set }
}

extension FooImplementedWithArray
{
public mutating func foo( i : Int ) -> Void { bar.append( i ) }
}

and then the implementation just requires defining the stored property

public struct AThirdFooImpl : FooImplementedWithArray
{
public var bar = Array()   // that’s all we need = 
the protocol extension supplies the rest
}

But the problem is .. bar is now public. Worse, as the foo() was cunningly 
declared to be mutating, bar has to be a { get set } property, anyone using the 
class can totally break it. 

If I make FooImplementedWithArray internal, bar is internal, however that also 
makes foo() internal and means none of my implementations can be anything more 
than internal. My feeling was that if you were allowed to mark things in a 
protocol as more restricted than the protocol itself, eg make bar private 
within a public FooImplementedWithArray, that would work and the compiler could 
synthesise the code you would write yourself. 

Is there a reason why all protocol elements must have the same visibility as 
the protocol itself otherwise there’s a potential visibility inconsistency, or 
is this just a feature I should request. 
Is there another way to do what I’m trying to do here, have the compiler do my 
work for me but have my stored property hidden? 











___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 11:14 , Kyle Sluder  wrote:
> 
> You know what I look like with a bad haircut

Your haircut is fine, but you were unlucky to be co-presenting with Tony, who 
had the best haircut amongst any of the presenters I’ve seen both far. I’d sell 
my soul for that haircut.



___

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: Trouble With NSURLSession...

2015-06-16 Thread Greg Parker

> On Jun 16, 2015, at 7:45 PM, Peters, Brandon  wrote:
> 
> Here is the exact compiler message:
> 
> swift:20:26: Cannot find an initializer for type 'NSURLSession' that accepts 
> an argument list of type '(configuration: NSURLSessionConfiguration, 
> delegate: HSNDataManager.Type, delegateQueue: nil)'
> 
> Hello,
> 
> I am creating a class to handle downloading my app’s data. I am using Xcode 
> with iOS 8.4 SDK and I keep getting from the compiler that there is no 
> initializer for NSURLSession that accepts the list of arguments I am using:
> 
> 
> import UIKit
> 
> class HSNDataManager: NSObject, NSURLSessionDelegate, 
> NSURLSessionTaskDelegate,
> NSURLSessionDownloadDelegate {
> 
>   static let dataManager = HSNDataManager()
> 
>   class func getRemoteData() {
>   // url session configuration
>   let urlSessionConfiguration = 
> NSURLSessionConfiguration.defaultSessionConfiguration()
>   // create url session for downloading our sites database file
>   var urlSession = NSURLSession(configuration: urlSessionConfiguration, 
> delegate: self, delegateQueue: nil)

You're inside a class func. `self` is the class object for class 
HSNDataManager. That class object is not a valid delegate. Presumably you need 
to pass an instance of HSNDataManager as the delegate object.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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: Trouble With NSURLSession...

2015-06-16 Thread Quincey Morris
> 
On Jun 16, 2015, at 19:45 , Peters, Brandon  wrote:
> 
> swift:20:26: Cannot find an initializer for type 'NSURLSession' that accepts 
> an argument list of type '(configuration: NSURLSessionConfiguration, 
> delegate: HSNDataManager.Type, delegateQueue: nil)'

The function that calls this is a *class* function, so ‘self’ is a class 
object, not an instance of the class (which is what actually conforms to the 
NSURLSessionDelegate protocol). You can actually see that in the error message, 
where it tells you that the type of your object is HSNDataManager.Type (that 
is, a type of type).


___

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: Trouble With NSURLSession...

2015-06-16 Thread Marco S Hyman
> swift:20:26: Cannot find an initializer for type 'NSURLSession' that accepts 
> an argument list of type '(configuration: NSURLSessionConfiguration, 
> delegate: HSNDataManager.Type, delegateQueue: nil)’

You are passing “self” as the delegate in a *class* method. The class is
not a NSURLSessionDelegate?.  Instances of the class are.

Marc
___

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: Trouble With NSURLSession...

2015-06-16 Thread Peters, Brandon
Figured it out: Needed to be ->

var urlSession = NSURLSession(configuration: urlSessionConfiguration, delegate: 
HSNDataManger.dataManager, delegateQueue: nil)



On Jun 16, 2015, at 10:42 PM, Peters, Brandon 
mailto:bap...@my.fsu.edu>> wrote:

Hello,

I am creating a class to handle downloading my app’s data. I am using Xcode 
with iOS 8.4 SDK and I keep getting from the compiler that there is no 
initializer for NSURLSession that accepts the list of arguments I am using:


import UIKit

class HSNDataManager: NSObject, NSURLSessionDelegate, NSURLSessionTaskDelegate,
NSURLSessionDownloadDelegate {

   static let dataManager = HSNDataManager()

   class func getRemoteData() {
   // url session configuration
   let urlSessionConfiguration = 
NSURLSessionConfiguration.defaultSessionConfiguration()
   // create url session for downloading our sites database file
   var urlSession = NSURLSession(configuration: urlSessionConfiguration, 
delegate: self, delegateQueue: nil)
   // server location with file name
   if let url = NSURL(string: HSNConstants.sitesDBFileName) {
   // task type for location
   let downloadSessionTask = urlSession.downloadTaskWithURL(url)
   // start downloading DB
   downloadSessionTask.resume()
   }
   }

   func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didResumeAtOffset fileOffset: Int64, 
expectedTotalBytes: Int64) {

   }

   func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: 
Int64, totalBytesExpectedToWrite: Int64) {

   }

   func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {

   }

   func URLSession(session: NSURLSession, task: NSURLSessionTask, 
didCompleteWithError error: NSError?) {

   }

}

But the signature appears in the documentation/API reference. Why would the 
compiler say this when  it actually compiled fine when the code snippet resided 
in another .swift module?

___

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/bap04e%40my.fsu.edu

This email sent to bap...@my.fsu.edu

___

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

Trouble With NSURLSession...

2015-06-16 Thread Peters, Brandon
Here is the exact compiler message:

swift:20:26: Cannot find an initializer for type 'NSURLSession' that accepts an 
argument list of type '(configuration: NSURLSessionConfiguration, delegate: 
HSNDataManager.Type, delegateQueue: nil)'

Hello,

I am creating a class to handle downloading my app’s data. I am using Xcode 
with iOS 8.4 SDK and I keep getting from the compiler that there is no 
initializer for NSURLSession that accepts the list of arguments I am using:


import UIKit

class HSNDataManager: NSObject, NSURLSessionDelegate, NSURLSessionTaskDelegate,
NSURLSessionDownloadDelegate {

   static let dataManager = HSNDataManager()

   class func getRemoteData() {
   // url session configuration
   let urlSessionConfiguration = 
NSURLSessionConfiguration.defaultSessionConfiguration()
   // create url session for downloading our sites database file
   var urlSession = NSURLSession(configuration: urlSessionConfiguration, 
delegate: self, delegateQueue: nil)
   // server location with file name
   if let url = NSURL(string: HSNConstants.sitesDBFileName) {
   // task type for location
   let downloadSessionTask = urlSession.downloadTaskWithURL(url)
   // start downloading DB
   downloadSessionTask.resume()
   }
   }

   func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didResumeAtOffset fileOffset: Int64, 
expectedTotalBytes: Int64) {

   }

   func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: 
Int64, totalBytesExpectedToWrite: Int64) {

   }

   func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {

   }

   func URLSession(session: NSURLSession, task: NSURLSessionTask, 
didCompleteWithError error: NSError?) {

   }

}

But the signature appears in the documentation/API reference. Why would the 
compiler say this when  it actually compiled fine when the code snippet resided 
in another .swift module?

___

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

Trouble With NSURLSession...

2015-06-16 Thread Peters, Brandon
Hello,

I am creating a class to handle downloading my app’s data. I am using Xcode 
with iOS 8.4 SDK and I keep getting from the compiler that there is no 
initializer for NSURLSession that accepts the list of arguments I am using:


import UIKit

class HSNDataManager: NSObject, NSURLSessionDelegate, NSURLSessionTaskDelegate,
NSURLSessionDownloadDelegate {

static let dataManager = HSNDataManager()

class func getRemoteData() {
// url session configuration
let urlSessionConfiguration = 
NSURLSessionConfiguration.defaultSessionConfiguration()
// create url session for downloading our sites database file
var urlSession = NSURLSession(configuration: urlSessionConfiguration, 
delegate: self, delegateQueue: nil)
// server location with file name
if let url = NSURL(string: HSNConstants.sitesDBFileName) {
// task type for location
let downloadSessionTask = urlSession.downloadTaskWithURL(url)
// start downloading DB
downloadSessionTask.resume()
}
}

func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didResumeAtOffset fileOffset: Int64, 
expectedTotalBytes: Int64) {

}

func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: 
Int64, totalBytesExpectedToWrite: Int64) {

}

func URLSession(session: NSURLSession, downloadTask: 
NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {

}

func URLSession(session: NSURLSession, task: NSURLSessionTask, 
didCompleteWithError error: NSError?) {

}

}

But the signature appears in the documentation/API reference. Why would the 
compiler say this when  it actually compiled fine when the code snippet resided 
in another .swift module?

___

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: AppDelegate vs Custom View Controllers for Download Task...

2015-06-16 Thread Alex Zavatone
Why not just create a singleton to manage the processes?

Putting it in the appDelegate sounds like "I'm putting it there because I don't 
know where else to put it".  

Declare an object that exists as long as you need it to, put the code in there, 
dispose of it when you don't need it anymore.

On Jun 16, 2015, at 6:37 PM, Peters, Brandon wrote:

> Hi,
> 
> I have “duplicate” code for downloading a DB file in two custom view 
> controllers that I think would be better served if the download were 
> initiated when the App launches on the iPhone/iPad. My plan is to make the 
> AppDelegate a delegate of NSURL session (and the various other NSURL delegate 
> stuff it would need) Is there any “known” danger in making the AppDelegate a 
> NSURL session delegate?
> 
> Sorry for wording.
> 
> ___
> 
> 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

Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?

2015-06-16 Thread Shane Stanley
On 17 Jun 2015, at 1:59 am, Dave  wrote:
> 
> I’m was about to add AppleScript Handling to my App and I’ll need to do a lot 
> of NSAppleEventDescriptor fishing, is there any advance documentation 
> relating to this?

Look in the NSAppleEventDescriptor header file -- it should be self-explanatory.

-- 
Shane Stanley 



___

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: AppDelegate vs Custom View Controllers for Download Task...

2015-06-16 Thread David Grant
Assuming it's only the one call for everything you'll need when the app starts 
it makes sense. 

Without knowing more detail it's hard to tell you that's the way you should go 
with it.

Sent from my iPad

> On Jun 16, 2015, at 3:37 PM, Peters, Brandon  wrote:
> 
> Hi,
> 
> I have “duplicate” code for downloading a DB file in two custom view 
> controllers that I think would be better served if the download were 
> initiated when the App launches on the iPhone/iPad. My plan is to make the 
> AppDelegate a delegate of NSURL session (and the various other NSURL delegate 
> stuff it would need) Is there any “known” danger in making the AppDelegate a 
> NSURL session delegate?
> 
> Sorry for wording.
> 
> ___
> 
> 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/dmgrant%40infinitydigital.com
> 
> This email sent to dmgr...@infinitydigital.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

Re: AppDelegate vs Custom View Controllers for Download Task...

2015-06-16 Thread Peters, Brandon
Jens,

I will try that. I did find an example of what I described on GitHub, but again 
your solution sounds clean. Thanks.

On Jun 16, 2015, at 6:43 PM, Jens Alfke 
mailto:j...@mooseyard.com>> wrote:


On Jun 16, 2015, at 3:37 PM, Peters, Brandon 
mailto:bap...@my.fsu.edu>> wrote:

Is there any “known” danger in making the AppDelegate a NSURL session delegate?

No, but it doesn’t sound like a good design. The app delegate is for starting 
up the app and responding to some events from outside.

It would be cleaner to create a new class for managing the download, and make 
that the delegate. Then the app delegate can just make a one-line call to that.

—Jens

___

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: AppDelegate vs Custom View Controllers for Download Task...

2015-06-16 Thread Jens Alfke

> On Jun 16, 2015, at 3:37 PM, Peters, Brandon  wrote:
> 
> Is there any “known” danger in making the AppDelegate a NSURL session 
> delegate?

No, but it doesn’t sound like a good design. The app delegate is for starting 
up the app and responding to some events from outside.

It would be cleaner to create a new class for managing the download, and make 
that the delegate. Then the app delegate can just make a one-line call to that.

—Jens
___

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

AppDelegate vs Custom View Controllers for Download Task...

2015-06-16 Thread Peters, Brandon
Hi,

I have “duplicate” code for downloading a DB file in two custom view 
controllers that I think would be better served if the download were initiated 
when the App launches on the iPhone/iPad. My plan is to make the AppDelegate a 
delegate of NSURL session (and the various other NSURL delegate stuff it would 
need) Is there any “known” danger in making the AppDelegate a NSURL session 
delegate?

Sorry for wording.

___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Maxthon Chan
I like the storyboard references, but where’d object references go?

> On Jun 17, 2015, at 02:14, Kyle Sluder  wrote:
> 
> On Tue, Jun 16, 2015, at 02:34 AM, Roland King wrote:
>> And now I know what Kyle looks like too! 
> 
> You know what I look like with a bad haircut and not a lot of sleep. :P
> 
> BTW, the session is more precisely called What's New in Storyboards, in
> case anyone is having trouble finding it.
> 
> --Kyle Sluder
> ___
> 
> 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/max%40maxchan.info
> 
> This email sent to m...@maxchan.info



smime.p7s
Description: S/MIME cryptographic signature
___

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

Weird infinite loop in _logos_method$VCModCore$__ABT$viewDidLoad

2015-06-16 Thread Doug Hill
I’m seeing a weird crash in our app coming from our App Store version. It goes 
into an infinite loop then crashes the app; see below.

=

0   libobjc.A.dylib lookUpImpOrForward + 3
1   libobjc.A.dylib lookUpImpOrNil + 18
2   libobjc.A.dylib lookUpImpOrNil + 18
3   libobjc.A.dylib class_respondsToSelector + 36
4   Foundation  +[NSBundle bundleForClass:] + 66
5   UIKit   -[UIWindow isInternalWindow] + 76
6   UIKit   +[UIWindow 
_enumerateWindowsIncludingInternalWindows:onlyVisibleWindows:withBlock:] + 120
7   UIKit   +[UIWindow 
allWindowsIncludingInternalWindows:onlyVisibleWindows:forScreen:] + 126
8   UIKit   +[UIWindow 
allWindowsIncludingInternalWindows:onlyVisibleWindows:] + 30
9   UIKit   -[UIViewController _window] + 238
10  UIKit   -[UIViewController loadViewIfRequired] + 104
11  UIKit   -[UIViewController view] + 24
 Start of infinite loop
12  Chartcube   _logos_method$VCModCore$__ABT$viewDidLoad + 
155804
13  UIKit   -[UIViewController loadViewIfRequired] + 600
14  UIKit   -[UIViewController view] + 24
 Go back to start
15  Chartcube   _logos_method$VCModCore$__ABT$viewDidLoad + 
155804


===


We haven’t been able to reproduce this crash in-house but we’ve been getting a 
number of crash reports from our crash reporting library.

I have no idea why this is happening and I don’t know what the mangled _logos 
symbol is exactly (other than it’s some sort of internal implementation).

Anyone have any insight into what this is or possibly why it’s happening.

Thanks!

Doug Hill
http://chartcube .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

Re: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Kyle Sluder
On Tue, Jun 16, 2015, at 02:34 AM, Roland King wrote:
> And now I know what Kyle looks like too! 

You know what I look like with a bad haircut and not a lot of sleep. :P

BTW, the session is more precisely called What's New in Storyboards, in
case anyone is having trouble finding it.

--Kyle Sluder
___

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: NSAppleEventDescriptor docs [was: Re: [Swift] best way to support 'keyword' args,...]

2015-06-16 Thread has

Dave wrote:

>> Thanks to Apple actioning Radar tickets 19169736 
, 19169791 
, and 18944184 
, there are now modern, fully 
supported NSAppleEventDescriptor APIs arriving in 10.11 that will allow 
third-party code to do all this stuff without having to go through 
ancient legacy or deprecated Carbon APIs any more.

>
> I’m was about to add AppleScript Handling to my App and I’ll need to 
do a lot of NSAppleEventDescriptor fishing, is there any advance 
documentation relating to this? I’m an Apple Developer and under NDA.



First things first, be aware that Apple event IPC makes *infinitely more 
sense* once you realize it ISN'T OOP, but remote procedure calls with 
simple first-class relational query values as arguments. Your app's 
"scripting interface" presents an idealized view onto its user data as a 
relational object graph, against which those queries are then evaluated. 
[1] Go read Dr William Cook's HOPL paper for excellent background on why 
and how it was designed that way [2]:


http://www.cs.utexas.edu/~wcook/Drafts/2006/ashopl.pdf

The usual way to add AE handling to a Cocoa app is to use the Cocoa 
Scripting framework. It has flaws, but unless you've a specific reason 
not to use it then it's probably the least painful option currently 
available. (If I ever get a spare year with nothing better to do I might 
write a replacement, but already I've enough mad projects on the go to 
keep me busy for the foreseeable.)


Matt Neuburg's written some useful stuff on CS in the past, and there's 
docs on Apple's own site as well, including the Scripting Interface 
Guidelines which you should track down and read.



While I don't use CS myself, I understand that the way Cocoa Scripting 
handles events and queries is kind of poor: each incoming AE is 
dispatched to a corresponding 'Command' class, one for each kind of 
event; and it's all a single-dispatch, nominal-typing, traditionalist OO 
flavored mindset, where queries tend to get unpacked into arrays of 
objects representing individual model objects which then frequently a 
pig to wrangle efficiently and correctly, e.g. try running this and see 
how many off-by-N errors you can identify:


tell application "TextEdit"
make new document with properties {text:"one two three four 
five six sovon eight nine ton"}

set (every word where it contains "e") of document 1 to "?"
end tell

Whereas Apple events really need a multimethod-style approach to 
dispatching that uses structural-typing-like pattern matching to route 
incoming events to as many different 'handler' classes as you need to 
represent all the different verb(noun,noun,noun,...) combinations your 
app supports, and lets you decide exactly how you want to resolve 
queries and perform operations yourself. e.g. `move document 1 to end of 
documents` is a totally different operation to `move word 1 to end of 
paragraph 1`, so why would you want it dispatching both requests to the 
same NSScriptMoveCommand class? (And let's not even get into the sheer 
awfulness of its default Text Suite implementation.)


Like I say, AEs are not OOP, and probably 80% of programmers' pain and 
hate comes from wrongly trying to treat them as such (the other 20% 
being due to a formal spec that's so hand-wavy and open-ended it's very 
hard to figure out how you _should_ do it). OTOH, unless you're willing 
(and crazy enough) to design and build your own AE handling framework 
from scratch, I recommend you just slum it with CS. Oh, and stick to 
AppleScript for _all_ your testing as that is the benchmark and the only 
currently supported AE bridge that actually works right[3].



As to wrangling NSAppleEventDescriptor directly (assuming you're either 
not using CS, or that CS is unable to pack and unpack them automatically 
for you), the docs on developer.apple.com haven't been updated yet, but 
the new methods all look to be based on my submitted patches which are 
taken from here, so just read the comments on those if they're not 
already self-explanatory:


https://bitbucket.org/hhas/appleeventbridge/src

NSAppleEventDescriptor+AEDescExtensions.h
NSAppleEventDescriptor+AEDescMoreExtensions.h

The only difference I've noticed thus far is the -send... event has a 
slightly different signature and a bug in the timeout argument, which 
I'll radar later [4].


If you're going to start packing and unpacking complex more complex 
descriptors (e.g. lists, records) yourself, you may find it useful to 
pinch code from my AEMCodecs class too.


If you want to talk about stuff off-list then you're welcome to email me 
directly. Matt Neuburg and Shane Stanley are also well worth tracking 
down and picking their brains for guru treats, and both periodically 
appear on this list too.


HTH

has


[1] Pin this on your wall as a reminder every day: grasping this 
unfamiliar but simple trut

Re: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 10:06 , Maxthon Chan  wrote:
> 
> You don’t really need multiple repositories - two project files living in one 
> workspace is okay.

Oh, yes, you’re right. That was another thing I’d forgotten — that there was 
still something left that [explicit] workspaces were good for!



___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Maxthon Chan
You don’t really need multiple repositories - two project files living in one 
workspace is okay.
> On Jun 17, 2015, at 00:41, Quincey Morris 
>  wrote:
> 
> On Jun 16, 2015, at 01:36 , Kevin Meaney  wrote:
>> 
>> #if os(iOS)
> 
> Ah, thanks for reminding me about that. I keep forgetting that Swift has a 
> form of #if.
> 
> 
> On Jun 16, 2015, at 03:22 , Maxthon Chan  wrote:
>> 
>> You actually can build the OS X and iOS versions of the same framework with 
>> the same name, just keep the targets in separate projects and double-check 
>> when linking.
> 
> That’s a good approach, but I’ll have to experiment to find out how usable it 
> is in this case. Managing separate projects means managing separate 
> repositories (or manually forcing Xcode to stuff multiple projects in a 
> single repository).
> 
> It’s also a bit more complicated than I said, because there are 4 targets 
> (iOS, Mac MAS, Mac non-MAS and a data test app) and I want to use 3 different 
> namespaces for access control. It starts to get a bit hard to manage.
> 
> 
> What I’m actually thinking of doing is finishing the conversion using a 
> single target, then jettisoning the framework structure and just building all 
> the source files together. There was no real reason for the frameworks other 
> than access control, and (in this case) there’s no real reason for the access 
> control once the code is written.
> 
> 
> 
> ___
> 
> 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/max%40maxchan.info
> 
> This email sent to m...@maxchan.info



smime.p7s
Description: S/MIME cryptographic signature
___

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: NSWindow child window and key status

2015-06-16 Thread Ben
Thank you for the suggestion, unfortunately it does not fix the problem. I will 
probably end up using a tech support incident for this one.

- Ben


> On 15 Jun 2015, at 23:50, Quincey Morris 
>  wrote:
> 
> On Jun 15, 2015, at 13:38 , Ben  > wrote:
>> 
>> I'm trying to replicate a portion of UI in a manner similar to the formula 
>> editor of Numbers. For those not familiar, its a widget that floats above 
>> the spreadsheet grid featuring a text view and a button or two.
>> 
>> Currently I am using the addChildWindow:ordered: method on NSWindow to add a 
>> custom borderless window above the grid view and putting an NSTextView in 
>> that window. So far so good.
> 
> Have you tried implementing this with a NSPanel? It’s designed (when 
> configured with suitable options) to float over other windows — though not a 
> *specific* other window. It doesn’t take “main” status away from other 
> windows, and takes “key” status away only when firstResponder is actually in 
> one of its views (again when configured that way).
> 

___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 01:36 , Kevin Meaney  wrote:
> 
> #if os(iOS)

Ah, thanks for reminding me about that. I keep forgetting that Swift has a form 
of #if.


On Jun 16, 2015, at 03:22 , Maxthon Chan  wrote:
> 
> You actually can build the OS X and iOS versions of the same framework with 
> the same name, just keep the targets in separate projects and double-check 
> when linking.

That’s a good approach, but I’ll have to experiment to find out how usable it 
is in this case. Managing separate projects means managing separate 
repositories (or manually forcing Xcode to stuff multiple projects in a single 
repository).

It’s also a bit more complicated than I said, because there are 4 targets (iOS, 
Mac MAS, Mac non-MAS and a data test app) and I want to use 3 different 
namespaces for access control. It starts to get a bit hard to manage.


What I’m actually thinking of doing is finishing the conversion using a single 
target, then jettisoning the framework structure and just building all the 
source files together. There was no real reason for the frameworks other than 
access control, and (in this case) there’s no real reason for the access 
control once the code is written.



___

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

Prevent App Nap checkbox and Get Info

2015-06-16 Thread Michael Domino
Hi all,

I don’t know if this is the correct forum for this question, but please direct 
me elsewhere if it’s not.

I’ve noticed that some applications on my 10.10.3 system do not include the 
“Prevent App Nap” checkbox, and some do. My own application does not, but I 
don’t know for sure what I did to make that happen. I thought it might be 
related to manually adding the NSAppSleepDisabled setting to the application 
plist, but that does not seem to be the case. For example, Firefox.app 38.0.5 
*does* show the Prevent App Nap checkbox, as well as iMovie.app, but iPhoto.app 
and ITunes.app do not. 

What are the criteria for the presence of the “Prevent App Nap” checkbox in Get 
Info for any particular application? Is it the base sdk version? When I build 
my app with base sdk 10.5, “Prevent App Nap” appears, but built with 10.10 it 
does not.

Thanks,
Michael

___

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: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?

2015-06-16 Thread Dave

> Thanks to Apple actioning Radar tickets 19169736 
> , 19169791 
> , and 18944184 
> , there are now modern, fully 
> supported NSAppleEventDescriptor APIs arriving in 10.11 that will allow 
> third-party code to do all this stuff without having to go through ancient 
> legacy or deprecated Carbon APIs any more.

I’m was about to add AppleScript Handling to my App and I’ll need to do a lot 
of NSAppleEventDescriptor fishing, is there any advance documentation relating 
to this? I’m an Apple Developer and under NDA.

All the Best
Dave


___

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: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?

2015-06-16 Thread has

On 15/06/2015 18:39, Quincey Morris wrote:
On Jun 15, 2015, at 10:17 , has > wrote:


the goal is to enable a user to print an object specifier and be able 
to copy-and-paste that straight into another script -  i.e. 
`-description` should always return a string that represents valid 
Swift code


I dunno about #1 or #2, but for #3 look into the “Custom…” family of 
protocols, especially ‘CustomStringConvertible’, which is the one that 
defines ‘description’ and ‘debugDescription’ as having more-or-less 
their Obj-C meanings. IIRC, CustomStringConvertible is also the one 
that allows your custom type to participate in string interpolation: 
“\(variableOfYourType)”, which would connect you with what I assume 
you mean by “printing".


The standard protocols are all documented in the Swift Standard 
Library document for Swift 2. It’s worth browsing the list to see if 
there’s other stuff that might be helpful. Any of the “…Convertible” 
protocols might open up possibilities for streamlining your invocation 
syntaxes.


Will give it a crack, thanks. (Just discovered the amazing answer to #1, 
so am off to play with that first.;)


has
___

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: Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
What that page actually says to do, is to connect your printer then
let OS X choose the driver for you.

The driver I need is not available for manual selection.

I didn't really want to have to connect a printer to download the
driver, because it would look quite strange, if not downright
offensive, to hook up my printer at Starbucks.

On 6/16/15, Alex Zavatone  wrote:
>
> On Jun 16, 2015, at 6:34 AM, Michael David Crawford wrote:
>
>> I was finally able to download that 1 GB printer driver assortment,
>> but only by wandering around trying different wifi spots.
>>
>> I knew that I could have downloaded just a 24 MB driver for my
>> specific printer but that would have come at the cost of bringing that
>> printer with me to a wifi spot so OS X would see that it was connected
>> via USB.
>
> Or maybe you could have logged on to Epson's site and downloaded that one
> driver you wanted all by itself from the support page.
>
> http://www.epson.com/cgi-bin/Store/support/SupportYosemite.jsp
>
>
>


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Most People Still Use Dialup

2015-06-16 Thread Alex Zavatone

On Jun 16, 2015, at 6:34 AM, Michael David Crawford wrote:

> I was finally able to download that 1 GB printer driver assortment,
> but only by wandering around trying different wifi spots.
> 
> I knew that I could have downloaded just a 24 MB driver for my
> specific printer but that would have come at the cost of bringing that
> printer with me to a wifi spot so OS X would see that it was connected
> via USB.

Or maybe you could have logged on to Epson's site and downloaded that one 
driver you wanted all by itself from the support page.

http://www.epson.com/cgi-bin/Store/support/SupportYosemite.jsp



___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Dave
> There are old-school reasons and new-school reasons.
> 
> One of the biggest old-school reason is source duplication. You have to write 
> everything “twice”, once in @interface, once in @implementation. This has 
> been mitigated somewhat over the years, but Obj-C is literally twice the 
> number of files as Swift, and (in my experience so far) twice the number of 
> source lines to do the same thing.

You don’t have to “write everything twice”, (you *might* do that, but you don’t 
have to). The only thing you have to define “twice” are public methods and you 
just copy and paste these anyway. There are more files, but the .h file is 
generated automatically when you create the Class, so it’s no big deal.

Dave





___

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: Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
Northern China has to talk to Southern China via Japan.  This because
some party official gave his son the gift of what at one time was the
northern part of the state telecommunications monopoly.

On 6/16/15, Michael David Crawford  wrote:
> I was finally able to download that 1 GB printer driver assortment,
> but only by wandering around trying different wifi spots.
>
> I knew that I could have downloaded just a 24 MB driver for my
> specific printer but that would have come at the cost of bringing that
> printer with me to a wifi spot so OS X would see that it was connected
> via USB.  If OS X can choose my driver because it identifies itself,
> why can't I just tell OS X myself?
>
> Or Epson; Epson's driver download page specifically says to plug the
> printer in then let OS X take care of it.
>
> Some wifi spots have a lot of capacity but rate-limit individual clients.
>
> In the case of my dialup I would be able to download that 24 MB driver
> but there is some problem somewhere out on the Internet backbone.  I
> don't really know but speculate that it has to do with the routers all
> being optimized to server Facebook to cable modem users.
>
> I used dialup from rural Maine from 2001 to 2003 and it worked just
> fine; it even worked OK to set up IP masquerading so my ex and I could
> share the dialup service.
>
> If I traceroute from here in Salmon Creek, Washington to my server at
> Hurricane Electric in Fremont, California it goes through dozens of
> routers, many of which are clearly in the same data center.  That is,
> I'll go through ten or twenty routers at Level 3 in Seattle, then
> another ten or twenty in Fremont.
>
> When I start my day I "flush the tubes" with the following:
>
>$ sudo ping -c 100 -f apple.com
>$ sudo ping -c 100 -f berkeley.edu
>$ sudo ping -c 100 -f www.vatican.va
>
> By tracerouting before and after that flushing, I can see that my
> packets traverse far fewer routers.
> --
> Michael David Crawford, Consulting Software Engineer
> mdcrawf...@gmail.com
> http://www.warplife.com/mdc/
>
>Available for Software Development in the Portland, Oregon Metropolitan
> Area.
>


-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Most People Still Use Dialup

2015-06-16 Thread Michael David Crawford
I was finally able to download that 1 GB printer driver assortment,
but only by wandering around trying different wifi spots.

I knew that I could have downloaded just a 24 MB driver for my
specific printer but that would have come at the cost of bringing that
printer with me to a wifi spot so OS X would see that it was connected
via USB.  If OS X can choose my driver because it identifies itself,
why can't I just tell OS X myself?

Or Epson; Epson's driver download page specifically says to plug the
printer in then let OS X take care of it.

Some wifi spots have a lot of capacity but rate-limit individual clients.

In the case of my dialup I would be able to download that 24 MB driver
but there is some problem somewhere out on the Internet backbone.  I
don't really know but speculate that it has to do with the routers all
being optimized to server Facebook to cable modem users.

I used dialup from rural Maine from 2001 to 2003 and it worked just
fine; it even worked OK to set up IP masquerading so my ex and I could
share the dialup service.

If I traceroute from here in Salmon Creek, Washington to my server at
Hurricane Electric in Fremont, California it goes through dozens of
routers, many of which are clearly in the same data center.  That is,
I'll go through ten or twenty routers at Level 3 in Seattle, then
another ten or twenty in Fremont.

When I start my day I "flush the tubes" with the following:

   $ sudo ping -c 100 -f apple.com
   $ sudo ping -c 100 -f berkeley.edu
   $ sudo ping -c 100 -f www.vatican.va

By tracerouting before and after that flushing, I can see that my
packets traverse far fewer routers.
-- 
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.
___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Maxthon Chan
You actually can build the OS X and iOS versions of the same framework with the 
same name, just keep the targets in separate projects and double-check when 
linking.

> On Jun 16, 2015, at 16:36, Kevin Meaney  wrote:
> 
> 
>> The other major problem I ran into — unrelated, but I’m mentioning it in 
>> case someone wants to jump in and tell me the easy way — is that I’m trying 
>> to use frameworks in order to break the project into modules so that I can 
>> use the access controls (private and internal) to keep implementation 
>> details of related groups of files out of the grasp of unrelated code. This 
>> is in a cross-platform (OS X, iOS) project with shared code. Since the 
>> different platforms need different frameworks, and the frameworks/modules 
>> have to have different names to tell them apart, I can’t share source code 
>> files across platforms because of the “import” statements. Maybe I’m missing 
>> something obvious here.
>> 
> 
> I have a similar related problem.
> 
> My cross platform project builds both iOS and OS X Frameworks. I run the same 
> test code on the iOS and OS X frameworks. In my swift test code I use #if 
> os(iOS) to differentiate.
> 
> #if os(iOS)
> import UIKit
> import MovingImagesiOS
> import Photos
> #endif
> 
> I also have a small number of cases where I use.
> 
> #if os(OSX)
> 
> and I have a couple of tests that don’t work on the iOS simulator and I use 
> the
> 
> #if !(os(iOS) && arch(x86_64))
> 
> to exclude.
> 
> Kevin
> 
>>> And now I know what Kyle looks like too!
>> 
>> What’s the video?
>> 
>> 
>> 
>> ___
>> 
>> 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/ktam%40yvs.eu.com
>> 
>> This email sent to k...@yvs.eu.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/max%40maxchan.info
> 
> This email sent to m...@maxchan.info



smime.p7s
Description: S/MIME cryptographic signature
___

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: Most People Still Use Dialup

2015-06-16 Thread Maxthon Chan
From where I live despite we have fiber broadband connection but in practice it 
is slow like hell when connecting to anything that is not on the same carrier, 
and 4G traffic is extremely expensive (US$10 for 1GB of traffic.)

Since I don’t write games, I try my best to make apps as tiny as possible - my 
usual limit is 5MB packaged size.

> On Jun 16, 2015, at 14:37, Michael David Crawford  
> wrote:
> 
> Where I live I can only get dialup; to download anything these days I
> have to go to a wifi spot.
> 
> Just now I'm downloading the 1 GB Epson Printer Drivers from Apple's
> downloads page; despite being the only customer in the place, Firefox
> estimates the download will require 18 hours.
> 
> I have a Facebook friend who lives in West Africa.  He has decent
> connectivity but only from a cybercafe.  He has no way to save his own
> documents because no one sells flash drives there.
> 
> There are many places in the world where one can get online with a
> smartphone but again have no way to save any documents they download.
> 
> When I was the Product Development Manager for Working Software I kept
> twelve people employed despite that I only had a 40 MB hard drive.
> 
> Michael David Crawford, Consulting Software Engineer
> mdcrawf...@gmail.com
> http://www.warplife.com/mdc/
> 
>   Available for Software Development in the Portland, Oregon Metropolitan
> Area.
> ___
> 
> 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/max%40maxchan.info
> 
> This email sent to m...@maxchan.info



smime.p7s
Description: S/MIME cryptographic signature
___

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: Goodbye and Thanks for All The Code

2015-06-16 Thread Michael David Crawford
I wrote:

> while the legal
> rights of the mentally ill are well-established in legislation as well
> as court precedent, those rights are not only not enforced, they are
> largely unknown.

One way I determine whether psychiatric hospital staff are aware of
the rights on mental inpatients is by fighting tooth-and-nail when I
am requested to wear a hospital gown.  While I don't like them it's
not that I won't wear them however my objective is to educate the
hospital staff.

In California specifically this is provided for under the
Lanterman-Petris-Short Act.

In the emergency room at Stanford Medical Center:

"I have the right to wear my own clothes.  I want my suit back."

"Sir you are on an involuntary hold.  If you don't calm down, we have
the right to sedate you."

"That's _completely_ cool but when you do I want to be wearing my damn suit."

In reality my concern is not for myself but for those who are too far
gone to even know that they have rights.  I once had a close friend
who was completely cool that a "toxic rain" was falling from the sky.
She wore a rain hat indoors and would cover her head with a newspaper
while outside.

"Look up at the sky."

Hesitantly, she does.

"Do you see that it's blue?  That there are no clouds?  Do you feel
the warm sun?"

"Oh yes!  It's very nice."

But when she looks down, she experiences the continued chemical weapon attack.

While some mental illnesses are chronic, I have the good fortune that
my Bipolar-Type Schizoaffective Disorder - somewhat like being
manic-depressive and schizophrenic at the same time - is episodic, in
that the symptoms come and go.

I used to worry quite a lot about my professional reputation but
decided to go completely public with my illness as a result of the
Heaven's Gate UFO Cult mass suicide in San Diego during the Spring of
1997.  My reason was that I wanted to warn the public that reality is
not as concrete as it may seem.  I discuss this in "The Reality
Construction Kit":

http://www.warplife.com/mdc/books/schizoaffective-disorder/reality.html

My interest in cult phenomena commenced during the rise of Communism
in Cambodia in the early seventies when I read at first that Cambodian
children were taught to report their parents to the authorities,
shortly after which I learned that everyone in the entire country who
wore eyeglasses disappeared virtually overnight.

Computers are cool and all that, I really _do_ enjoy writing code but
some things are really more important than how many mice one's app
scores in a trade rag product review.
Michael David Crawford, Consulting Software Engineer
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Software Development in the Portland, Oregon Metropolitan
Area.


On Mon, Jun 15, 2015 at 8:23 PM, Michael David Crawford
 wrote:
> I've been out of work for most of the last five years.  Many
> well-meaning yet sadly misinformed people give me what doubtlessly
> would be good advice for others, for example that I should go on
> disability, get into subsidized housing or to stop linking my essays
> about my mental illness from every page on my website, but those
> well-meaning people do not understand my values.
>
> For reasons having largely to do with the way I was raised, it is far,
> far more important to me to solve the problems of others than it is to
> solve my own problems.
>
> I sent this just now to an administrator at the Northwestern School of
> Law at Lewis and Clark College in Portland, Oregon.  I have many
> reasons to study law but primary among them are that while the legal
> rights of the mentally ill are well-established in legislation as well
> as court precedent, those rights are not only not enforced, they are
> largely unknown.
>
> That led for example, to my being very nearly beaten to death by two
> Oregon Health & Sciences University campus police officers.  When I
> regained consciousness three days later, while I could correctly
> visualize the spelling of my name when I thought out it, I could not
> spell it correctly when I tried to write it by hand with a pencil.
>
> I asked the American Civil Liberties Union to represent me in a Civil
> Rights complaint against OHSU but recieved a form letter that pointed
> out that they focus only on Constitutional concerns.  That doesn't
> make a whole lot of sense but that is what the ACLU actually said.
>
> To Wit:
>
> Ms. Sullivan,
>
> After a great deal of consideration, I have decided to change careers
> from Software Engineering to Public Interest as well as Civil Rights
> Law.
>
> However I'm not real sure how to get started.  I am of very modest
> means; were I to go back to Physics grad school, I know my way would
> be paid by my advisor's research grant.  I don't have a clue how I can
> pay for law school but given my lifelong dedication towards the
> service of others I expect some way can be found to pay my expenses.
>
> I wish to request an appointment for an Informational Interview,
> either with 

Re: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Roland King

>> And now I know what Kyle looks like too!
> 
> What’s the video?
> 

What’s New In Interface Builder. (The answer to that question appears to be 
some useful things to make your life easier but not so much you have to learn 
it all over again this year - so that’s good)
___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Kevin Meaney

> The other major problem I ran into — unrelated, but I’m mentioning it in case 
> someone wants to jump in and tell me the easy way — is that I’m trying to use 
> frameworks in order to break the project into modules so that I can use the 
> access controls (private and internal) to keep implementation details of 
> related groups of files out of the grasp of unrelated code. This is in a 
> cross-platform (OS X, iOS) project with shared code. Since the different 
> platforms need different frameworks, and the frameworks/modules have to have 
> different names to tell them apart, I can’t share source code files across 
> platforms because of the “import” statements. Maybe I’m missing something 
> obvious here.
> 

I have a similar related problem.

My cross platform project builds both iOS and OS X Frameworks. I run the same 
test code on the iOS and OS X frameworks. In my swift test code I use #if 
os(iOS) to differentiate.

#if os(iOS)
import UIKit
import MovingImagesiOS
import Photos
#endif

I also have a small number of cases where I use.

#if os(OSX)

and I have a couple of tests that don’t work on the iOS simulator and I use the

#if !(os(iOS) && arch(x86_64))

to exclude.

Kevin

>> And now I know what Kyle looks like too!
> 
> What’s the video?
> 
> 
> 
> ___
> 
> 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/ktam%40yvs.eu.com
> 
> This email sent to k...@yvs.eu.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

Re: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Quincey Morris
On Jun 16, 2015, at 00:34 , Roland King  wrote:
> 
> I think Protocol Extensions are the power feature to Swift this year

Yes, though I’ve been trying to convert a fair-sized app, and I ran into a 
conceptual difficulty when a protocol has a Self constraint.

In essence, a Self constraint prevents a protocol from being used like a base 
class. This shows up quickly when (say) you try to construct a Set 
which is going to contain various types that are unified only by MyProtocol. 
The underlying Set class has to Hashable, which means its also Equatable, which 
has a Self requirement to ensure that two objects being compared by == are of 
the same type.

You’d see this problem with the example in that video if you tried to make the 
SegueIdentifier protocol Hashable or Equatable.

Other really good features: value-type programming, and the ‘guard’ statement, 
which is much better in use than you’d expect.

The other major problem I ran into — unrelated, but I’m mentioning it in case 
someone wants to jump in and tell me the easy way — is that I’m trying to use 
frameworks in order to break the project into modules so that I can use the 
access controls (private and internal) to keep implementation details of 
related groups of files out of the grasp of unrelated code. This is in a 
cross-platform (OS X, iOS) project with shared code. Since the different 
platforms need different frameworks, and the frameworks/modules have to have 
different names to tell them apart, I can’t share source code files across 
platforms because of the “import” statements. Maybe I’m missing something 
obvious here.

> And now I know what Kyle looks like too!

What’s the video?



___

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: Language options: Objective-C, Swift, C or C++?

2015-06-16 Thread Roland King

> On 15 Jun 2015, at 05:56, Quincey Morris 
>  wrote:
> 
> On Jun 13, 2015, at 19:50 , Rick Mann  wrote:
>> 
>> Watch the talk on protocol-oriented programming 
>> (https://developer.apple.com/videos/wwdc/2015/?id=408 
>> ).
> 
> You liked that, huh? I also recommend “Swift in Practice” 
> (https://developer.apple.com/videos/wwdc/2015/?id=411 
> ), especially the part 
> about segue identifiers (which isn’t really about segue identifiers) in the 
> last 15 minutes or so.
> 
> It’s Wile E. Coyote stuff. One moment you’re smirking because you think 
> you’re way ahead of the guy, next moment you’re looking down and there’s no 
> ground under you any more.
> 

Wish I’d seen that one yesterday BEFORE I ended up working out myself how to do 
something similar. At least I got fairly close to that so I must be learning 
something. I think Protocol Extensions are the power feature to Swift this 
year, especially with the ‘where’ clauses; and the annotation of the entire 
class library with generic types, nullability etc is the work which reduce 
Cocoa integration friction.

ObjC keyword of this year is ‘__kindof’.  

I haven’t only been watching the Swift videos but some of the others too. I 
don’t think I’ve seen a piece of example code written in Objective C yet, apart 
from in the bits of the talks about actual new ObjC features. That’s quite 
telling. 

And now I know what Kyle looks like too! 
___

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