Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Charles Srstka
> On Aug 19, 2016, at 9:56 PM, Charles Srstka wrote: > >>> So for the foreseeable future, the >>> difference is that +array returns an autoreleased object, meaning that in >>> ARC code, +new is the better choice. >> >> I would not make that assumption. Who says

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Charles Srstka
> On Aug 19, 2016, at 8:25 PM, Kyle Sluder wrote: > > > > On Fri, Aug 19, 2016, at 06:08 PM, Charles Srstka wrote: >>> On Aug 19, 2016, at 3:46 PM, Quincey Morris >>> wrote: >>> >>> On Aug 19, 2016, at 10:53 , Charles Srstka

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Kyle Sluder
On Fri, Aug 19, 2016, at 06:08 PM, Charles Srstka wrote: > > On Aug 19, 2016, at 3:46 PM, Quincey Morris > > wrote: > > > > On Aug 19, 2016, at 10:53 , Charles Srstka > > wrote: > >> > >>

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Charles Srstka
> On Aug 19, 2016, at 3:46 PM, Quincey Morris > wrote: > > On Aug 19, 2016, at 10:53 , Charles Srstka > wrote: >> >> [NSArray array] is a synonym for [[[NSArray alloc] init] autorelease]. > >

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Carl Hoefs
> On Aug 19, 2016, at 1:46 PM, Quincey Morris > wrote: > > My point is that Apple might revisit the implementation of NSArray at any > time (in these Swiftian days, stranger things have happened), and choose to > write it with full ARC compatibility,

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Quincey Morris
On Aug 19, 2016, at 12:33 , dangerwillrobinsondan...@gmail.com wrote: > >> AFAICT, the main reason *not* to use ‘new’ is to avoid generating anxiety >> for those who come back to read the code later, and who might worry that the >> inconsistency means something. > > Even though new has been a

Re: odd drawInsertionPointInRect behavior

2016-08-19 Thread David Young
On Fri, Aug 19, 2016 at 02:10:50PM -0500, Ken Thomases wrote: > What happens when you switch away from your app or even from the window with > your text view? Do you get a call with turnedOn being false then? I'm afraid not. In every call, turnedOn == true. Dave -- David Young //\

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread dangerwillrobinsondanger
> On Aug 20, 2016, at 2:50 AM, Quincey Morris > wrote: > > AFAICT, the main reason *not* to use ‘new’ is to avoid generating anxiety for > those who come back to read the code later, and who might worry that the > inconsistency means something. Even

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Kirk
array = [NSArray new] and array = [NSArray array] -- Should be interchangeable under ARC. Kirk Kerekes (iPhone) > On Aug 19, 2016, at 12:22 PM, cocoa-dev-requ...@lists.apple.com wrote: > > array = [NSArray new] or array = [NSArray array]? ___

Re: odd drawInsertionPointInRect behavior

2016-08-19 Thread Ken Thomases
On Aug 16, 2016, at 9:31 PM, David Young wrote: > > I'm trying to draw my own NSTextView cursor. I expect that for each > pulse of the cursor, drawInsertionPointInRect(_:color:turnedOn:) will be > called twice, once with turnedOn == true and, shortly afterward, again > with

Re: Resend: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Alex Zavatone
To all who replied, thank you. This is awesome. Thanks for outlining the difference between the two. Now I know and can ignore it. But if I didn't, I'd always be wondering. This certainly puts my mind at ease. Well, at least with regards to [NSArray new]. Other issues shall remain uneased

Re: Resend: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Gary L. Wade
The class method new is the same as alloc/init although by implementation, it may be faster if the class doesn't need to pass a placeholder object from alloc—some classes do that. The class method array is much like alloc/init/autorelease in the MRC days although it may coalesce things, but

Re: Resend: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread David Duncan
+new is alloc/init. +array is alloc/init/autorelease. Should be equivalent. > On Aug 16, 2016, at 7:42 AM, Alex Zavatone wrote: > > I sent this out this morning but it got eaten, so this is a resend. Sorry if > it gets to some of you twice. > > > > Yes, I know about literals,

Re: Resend: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Charles Srstka
> On Aug 16, 2016, at 9:42 AM, Alex Zavatone wrote: > > I sent this out this morning but it got eaten, so this is a resend. Sorry if > it gets to some of you twice. > > > > Yes, I know about literals, but I have a different question here. > > > Is this safe? > > I have seen

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Quincey Morris
On Aug 16, 2016, at 02:20 , Alex Zavatone wrote: > > Is there any risk to using [NSArray new] to init an array instead of [NSArray > array]?? The only real difference between the two is the ownership semantics of the returned object. For ‘new’ it’s +1 and for ‘array’ it’s +0.

Re: Resend: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Ryan Dignard
Under ARC there should be no appreciable difference. People who prefer +new will generally point out it's a keyword or operator in other languages so its meaning is not ambiguous. With manual reference counting, the difference is that +array is autorelease where as with +new your code is

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Doug Hill
FWIW, I use the [Classname new] syntax when allocating just about any object instead of [[Classname alloc] init]. Including with arrays, especially NSMutableArray. I've never seen any issues. Doug Hill > On Aug 16, 2016, at 2:20 AM, Alex Zavatone wrote: > > Yes, I know about

Re: Launch, connect, communicate

2016-08-19 Thread Alastair Houghton
On 16 Aug 2016, at 00:26, Andrew Keller wrote: > > 1. If the main Plot app is _not_ running in the current Aqua session, then > launch a new copy in the current Aqua session. > 2. Open some sort of a socket to the main Plot app in the current Aqua > session. > 3. Accept

Re: Justification of collection cells in sections

2016-08-19 Thread Doug Hill
I'm now trying some techniques to fix the behavior to center items when there is one item in a collection view section. I'm trying two different approaches: 1. Like Peter's suggestion, create a subclass of UICollectionViewFlowLayout, and override layout attributes methods I create overrides

odd drawInsertionPointInRect behavior

2016-08-19 Thread David Young
I'm trying to draw my own NSTextView cursor. I expect that for each pulse of the cursor, drawInsertionPointInRect(_:color:turnedOn:) will be called twice, once with turnedOn == true and, shortly afterward, again with turnedOn == false. Instead, my method overriding drawInsertionPointInRect is

Re: Justification of collection cells in sections

2016-08-19 Thread Doug Hill
I'm now trying some techniques to fix the behavior to center items when there is one item in a collection view section. I'm trying two different approaches: 1. Like Peter's suggestion, create a subclass of UICollectionViewFlowLayout, and override layout attributes methods I create overrides

Re: Launch, connect, communicate

2016-08-19 Thread Andrew Keller
Am 16.08.2016 um 8:35 vorm. schrieb Jens Alfke : > On Aug 15, 2016, at 7:26 PM, Andrew Keller > wrote: >> >> 1. If the main Plot app is _not_ running in the current Aqua session, then >> launch a new copy in the current

Re: Resizing NSScrollView/NSClipView to fit NSTableView width

2016-08-19 Thread Quincey Morris
On Aug 16, 2016, at 01:13 , studfed studfed wrote: > > The problem is that table view is clipped by scroll view (what I mean is that > last several columns are visible only if you scroll to the right, but I would > like to have these last columns be visible without scrollers

Re: Proper setup for embedded framework

2016-08-19 Thread Lou Zell
Ok, through some trials in the WorkspaceExperiment [1] I've got the magic ordering: To embed a framework that's the output of a sibling project within the same Xcode workspace: 1. Build HelloFramework for iOS, _not_ for simulator 2. Go to Project Navigator > HelloApp > Target > Build Phases 3.

Re: Launch, connect, communicate

2016-08-19 Thread Jens Alfke
> On Aug 15, 2016, at 7:26 PM, Andrew Keller wrote: > > 1. If the main Plot app is _not_ running in the current Aqua session, then > launch a new copy in the current Aqua session. > 2. Open some sort of a socket to the main Plot app in the current Aqua > session. > 3.

Re: Proper setup for embedded framework

2016-08-19 Thread Lou Zell
Thanks Quincey, The easy thing to check is to look at the build phases for the app, and > make sure that the framework is listed in the Target Dependencies phase. When I tap on the plus sign next to the Target Dependencies build phase, the framework target is not listed as an option. That is,

Resend: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Alex Zavatone
I sent this out this morning but it got eaten, so this is a resend. Sorry if it gets to some of you twice. Yes, I know about literals, but I have a different question here. Is this safe? I have seen this in some code in our codebase: array = [NSArray new]; I'm familiar with using the

array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Alex Zavatone
Yes, I know about literals, but I have a different question here. I have seen this in some code in our codebase: array = [NSArray new]; I'm familiar with using the public method from the NSArray header and what the docs say to use: or array = [NSArray array]; Is there any risk to using