Re: Swift generics, circular type declarations, and segfaults, oh my!

2015-09-04 Thread Charles Srstka
> On Sep 4, 2015, at 7:59 PM, Quincey Morris 
>  wrote:
> 
> On Sep 4, 2015, at 16:31 , has  > wrote:
>> 
>> At risk of derail... 
> 
> Do you mean “derail” or “detail”? I feel like I’m drowning in details.
> 
> My (first) “huh?” was to ask why you would prefer SomeClass 
> ().makeASomeClassInstance () to SomeClass.makeASomeClassInstance (). I’m not 
> sure, but I think your answer is that *either* (a) you already have a 
> SomeClass instance, so who cares, *or* you don’t, but who cares? That is, 
> your API is deliberately (and presumably beneficially) conflating objects as 
> specifiers (of what data to retrieve) or retrievers (of the data itself).
> 
> What I mean is, in:
> 
>   TextEdit().documents[1].text.words.get()
> 
> the instances represented by ‘TextEdit()’, 'TextEdit().documents[1]’, 
> 'TextEdit().documents[1].text’ are just setting the context for what the 
> instance represented by 'TextEdit().documents[1].text.words’ is being asked 
> to retrieve.
> 
> If that’s what it is, then OK. (Even if it’s not that, it’s not up to me to 
> try to derail you, apart from throwing in that ‘huh?’.) So that’s that, I’ll 
> stay out of it. :)

The way I’m reading it, he or she is wrapping an application’s scripting 
dictionary, creating a Swift object to wrap each construct that would represent 
a noun, so to speak, in AppleScript. However, these entities are expensive to 
obtain, involving IPC, so s/he’s loading them lazily. What this means is that 
the objects are all going to have some number of properties that, when the user 
accesses them, will necessitate creating a new wrapper object.

> Regarding the rest of what you’re trying to do, the answer is no, you cannot 
> do it, isn’t it? You cannot have a method that returns objects of any of 
> several types *known at compile time*. The compiler simply won’t know which 
> behaviors a (potential) returned object would have, so it can’t compile code 
> that uses such references**. This is true of both Swift and Obj-C. Isn’t it?
> 
> 
> ** Without leaving validation to run-time, which you said you don’t want to 
> do.

I’m not the most knowledgeable about AppleScript, but what it sounds like from 
s/he’s saying is that the relationships between the AppleScript objects fall 
into three main categories, and for each type of object, there will be only one 
specific class to which each of the three relationships can point, so the 
object should be representable by a Swift generic with three parameterized 
types. However, if an object points to more of the same type of object, this 
results in something like Foo, and this causes either the compiler or the 
runtime to crash since it’s apparently not built to handle a generic being 
passed an object of its own type (honestly, this sounds like something 
warranting a Radar). S/he is asking if anyone knows of any way around this.

Charles

___

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

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

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

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

Re: Anyway to make a generic out of instancetype?

2015-09-04 Thread Rick Mann

> On Sep 4, 2015, at 18:29 , Jens Alfke  wrote:
> 
> 
>> On Sep 4, 2015, at 4:47 PM, Rick Mann  wrote:
>> 
>> I have some class methods that return NSArray*. I wanted to have them return 
>> NSArray*, but the compiler doesn't seem to like that. Is it 
>> worth trying to do?
> 
> Well, it should be  instead (the ‘*’ is already included in the 
> type), but in my experience ‘instancetype’ only works as the return type of a 
> method.

Yeah, sorry, mis-typed it. I tried it without (and with) the asterisk. It 
doesn't recognize it (despite being part of the return type.

-- 
Rick Mann
rm...@latencyzero.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: Puzzling memory creep

2015-09-04 Thread Quincey Morris
On Sep 4, 2015, at 06:25 , Richard Kennaway  wrote:
> 
> If anyone wants to take a look at the whole project, I've put a zip file at

FWIW, I don’t see any leaks when I run your test project. This is with Xcode 7 
beta 6 and the iOS 9 iPhone simulator, since that’s what I’ve got available 
right now.

I tried putting your date formatter code back in (using defaults for creating 
the objects, since you took the setup code out) and it still doesn’t leak. I 
see #Persistent fluctuate rapidly in this case, because the formatter causes 
lots of objects to be created transiently, but it always comes back to the same 
number.



___

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: Anyway to make a generic out of instancetype?

2015-09-04 Thread Jens Alfke

> On Sep 4, 2015, at 4:47 PM, Rick Mann  wrote:
> 
> I have some class methods that return NSArray*. I wanted to have them return 
> NSArray*, but the compiler doesn't seem to like that. Is it 
> worth trying to do?

Well, it should be  instead (the ‘*’ is already included in the 
type), but in my experience ‘instancetype’ only works as the return type of a 
method.

—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: Swift generics, circular type declarations, and segfaults, oh my!

2015-09-04 Thread Quincey Morris
On Sep 4, 2015, at 16:31 , has  wrote:
> 
> At risk of derail... 

Do you mean “derail” or “detail”? I feel like I’m drowning in details.

My (first) “huh?” was to ask why you would prefer SomeClass 
().makeASomeClassInstance () to SomeClass.makeASomeClassInstance (). I’m not 
sure, but I think your answer is that *either* (a) you already have a SomeClass 
instance, so who cares, *or* you don’t, but who cares? That is, your API is 
deliberately (and presumably beneficially) conflating objects as specifiers (of 
what data to retrieve) or retrievers (of the data itself).

What I mean is, in:

TextEdit().documents[1].text.words.get()

the instances represented by ‘TextEdit()’, 'TextEdit().documents[1]’, 
'TextEdit().documents[1].text’ are just setting the context for what the 
instance represented by 'TextEdit().documents[1].text.words’ is being asked to 
retrieve.

If that’s what it is, then OK. (Even if it’s not that, it’s not up to me to try 
to derail you, apart from throwing in that ‘huh?’.) So that’s that, I’ll stay 
out of it. :)

Regarding the rest of what you’re trying to do, the answer is no, you cannot do 
it, isn’t it? You cannot have a method that returns objects of any of several 
types *known at compile time*. The compiler simply won’t know which behaviors a 
(potential) returned object would have, so it can’t compile code that uses such 
references**. This is true of both Swift and Obj-C. Isn’t it?


** Without leaving validation to run-time, which you said you don’t want to do.

___

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

Visual glitch

2015-09-04 Thread Shane Stanley
My app has developed a visual glitch, and I'm hoping for some advice on how to 
rectify it. It occurs when entering or leaving the version browser, and it's a 
bit hard to describe, but part of what is mostly background area goes black. 
And I think it started happening when I moved to auto-layout, although I can't 
be certain.

There's no sign of it when I zoom or switch to/from full-screen mode; only 
going to/from the version browser (and only when I choose a version on the 
left, when leaving the version browser). 

The document window has a sidebar area to the left, although the black area 
tends to extend to the right of it, to a width that can vary. With the sidebar 
collapsed, the glitch is still there, although in a smaller way.

There's nothing particularly fancy in terms of constraints. The main split view 
has holding priorities of 270/250, and the left and right views it contains 
have >= constraints with a priority of 1000, but neither seem violated at any 
stage.

Any suggestions?

-- 
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

"Computed segue" in iOS?

2015-09-04 Thread Carl Hoefs
iOS 8.4.1

I need to segue from a UITableView to different view controllers depending 
which element in the table is touched (some elements are videos that need to be 
displayed/edited, some are data files that need to be graphed, etc.).

Is it possible to have a "computed segue" in iOS such that I can segue 
intelligently to the appropriate view controller based on some criteria? Or 
must I use a "stopgap" view controller invoked by the UITableView that will do 
the content analysis and then perform a segue to the appropriate view 
controller?

-Carl


___

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

Anyway to make a generic out of instancetype?

2015-09-04 Thread Rick Mann
I have some class methods that return NSArray*. I wanted to have them return 
NSArray*, but the compiler doesn't seem to like that. Is it 
worth trying to do?

Thanks,

-- 
Rick Mann
rm...@latencyzero.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 generics, circular type declarations, and segfaults, oh my!

2015-09-04 Thread has

On 03/09/2015 19:57, Quincey Morris wrote:
On Sep 3, 2015, at 11:16 , has > wrote:


* Using an instance as a factory for its own class is contrary to 
general usage, so is a smell at best. It’s a job for a class func.


No, it's fine. It's for an Apple event query builder. Any odd smells 
are probably the Apple event architecture's doing.


Huh? Why is it fine to create an additional unnecessary object? And 
what has this got to do with Apple events?




At risk of derail...

Apple event queries (object specifiers) are constructed as linked lists. 
I'm just putting a high-level user-friendly wrapper around that. Either 
the wrapper vends a new object each time the list is appended to, or it 
creates a single wrapper object that appends the list internally. The 
first approach is simpler and safer to use since there's no mutable 
state, and the cost of instantiating a few additional objects is trivial 
compared to the time it takes to send an AE and receive a reply, so I'm 
not worried about that. It's a tested, proven design - if you really 
want to understand it in detail then I suggest installing the original 
Python version (http://appscript.sourceforge.net/) and working through 
the tutorial.


My concern here is how to implement a Swift version, which means 
leveraging the Swift type system as much as practical and fighting it as 
little as I can. The Swift prototype 
(https://bitbucket.org/hhas/appleeventbridge/) currently uses a very 
simple class hierarchy consisting of a per-application code-generated 
Specifier class that inherits from a standard library-supplied base class:


AbstractBase // defines standard functionality
Specifier // adds app-specific properties, elements, commands, 
and standard selectors


Since there's only one concrete Specifier class, methods (and vars) that 
return new Specifier instances, standard methods inherited from 
AbstractBase can just declare their return type as 'Self', and the 
compiler will figure out the correct return type automatically.


The downside of the above approach is that not all specifier types 
(insertion, object, elements, etc.) support the same features, so some 
of the exposed's methods won't always work. It'd be better to represent 
each type of specifier as a different subclass that exposes only those 
methods that are valid on it, making invalid calls impossible:


AbstractBase // defines standard functionality
AbstractSpecifier // adds app-specific commands
InsertionSpecifier
ObjectSpecifier // adds app-specific properties and elements
ElementsSpecifier // adds standard selectors

The catch is that I can no longer declare all methods' return types as 
'Self', because they now return several (albeit related) types. 
ObjectSpecifiers need to vend InsertionSpecifiers, ObjectSpecifiers and 
ElementsSpecifiers. ElementsSpecifiers need to vend ObjectSpecifiers and 
ElementsSpecifiers. And each scriptable application needs its own 
code-generated versions of these classes too. The code generator can 
insert the correct type for app-defined vars, but the standard inherited 
methods can only (afaik) specify the correct return type if they're 
defined as a generic class, allowing the exact types to be supplied as 
parameters:


class AbstractBase {

}

thus allowing each application glue to parameterize that class with its 
own exact types, e.g.:


AbstractBase

Which takes us back to the problem described in my previous email, where 
the Swift compiler and runtime don't seem to like this circular 
referencing of related type names very much. Worst comes to the worst, 
I'll just have to throw _everything_ into the code generator, but that 
offends even my slobbish nature, so if there's a way to keep the 
standard functionality in a generic base class without Swift puking on it.




Chained var/method calls let you build and send AE queries using a 
non-atrocious syntax, e.g.:


   let result: [String] = try TextEdit().documents[1].text.words.get()


Again: huh? Where’s the factory method in this?


You're looking at them (this is why I prefer not to use GoF jargon 
myself). The `documents` var returns a new elements specifier, `[1]` 
returns a new object specifier, `text` returns a new object specifier, 
`words` returns a new elements specifier. Very easy to use, just a pain 
to explain how to implement. :p



Thanks,

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: String.join()?

2015-09-04 Thread Rick Mann
Done. 22584635

> On Sep 4, 2015, at 14:34 , Greg Parker  wrote:
> 
> 
>> On Sep 4, 2015, at 2:29 PM, Quincey Morris 
>>  wrote:
>> 
>>> On Sep 4, 2015, at 14:04 , Rick Mann  wrote:
>>> 
>>> According to the docs in Xcode 7b6, join(_:) is a method on String. But if 
>>> I try to call it:
>>> 
>>> Of course, I can't command-click on join() to get to its declaration, and 
>>> option-clicking on it doesn't link to its documentation.
>> 
>> Sorry, I forgot to start with the basic point, which is that there is no 
>> ‘join’ method anywhere any more (except in the ghostly form that lets the 
>> compiler tell you it doesn’t exist any more), so you can’t call it or 
>> command-click to it.
> 
> You should file a bug report. It might be possible to make unavailable 
> identifiers command-clickable, which would reveal their OS availability range 
> or their suggested replacements.
> 
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler
> 
> 


-- 
Rick Mann
rm...@latencyzero.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: String.join()?

2015-09-04 Thread Greg Parker

> On Sep 4, 2015, at 2:29 PM, Quincey Morris 
>  wrote:
> 
>> On Sep 4, 2015, at 14:04 , Rick Mann  wrote:
>> 
>> According to the docs in Xcode 7b6, join(_:) is a method on String. But if I 
>> try to call it:
>> 
>> Of course, I can't command-click on join() to get to its declaration, and 
>> option-clicking on it doesn't link to its documentation.
> 
> Sorry, I forgot to start with the basic point, which is that there is no 
> ‘join’ method anywhere any more (except in the ghostly form that lets the 
> compiler tell you it doesn’t exist any more), so you can’t call it or 
> command-click to it.

You should file a bug report. It might be possible to make unavailable 
identifiers command-clickable, which would reveal their OS availability range 
or their suggested replacements.


-- 
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: String.join()?

2015-09-04 Thread Rick Mann

> On Sep 4, 2015, at 14:29 , Quincey Morris 
>  wrote:
> 
> On Sep 4, 2015, at 14:04 , Rick Mann  wrote:
>> 
>> According to the docs in Xcode 7b6, join(_:) is a method on String. But if I 
>> try to call it:
> 
>> Of course, I can't command-click on join() to get to its declaration, and 
>> option-clicking on it doesn't link to its documentation.
> 
> Sorry, I forgot to start with the basic point, which is that there is no 
> ‘join’ method anywhere any more (except in the ghostly form that lets the 
> compiler tell you it doesn’t exist any more), so you can’t call it or 
> command-click to it.

See, now that seems wrong. If the compiler can tell me about it, it should be 
declared that way somewhere, and maybe there are comments near that location to 
help explain what's going on (granted, any such comments should be in the 
message, but perhaps that's too unwieldy, and yet the message itself leaves 
something to be desired).

But it is what it is.


-- 
Rick Mann
rm...@latencyzero.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: String.join()?

2015-09-04 Thread Quincey Morris
On Sep 4, 2015, at 14:04 , Rick Mann  wrote:
> 
> According to the docs in Xcode 7b6, join(_:) is a method on String. But if I 
> try to call it:

> Of course, I can't command-click on join() to get to its declaration, and 
> option-clicking on it doesn't link to its documentation.

Sorry, I forgot to start with the basic point, which is that there is no ‘join’ 
method anywhere any more (except in the ghostly form that lets the compiler 
tell you it doesn’t exist any more), so you can’t call it or command-click to 
it.



___

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: String.join()?

2015-09-04 Thread Marco S Hyman

> Searching the documentation for joinWithSeparator turns up nothing.

I’ve found the doc to be lacking in most beta builds, at least with respect to 
swift. One of the first things I commonly do is open a playgound and “import 
Swift” then command click on Swift to see the header.  If I remember I’ll save 
that header so I can diff it against the previous version (assuming I saved it, 
too) to see what’s new.

joinWithSeparator is defined for SequenceType and String.

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: String.join()?

2015-09-04 Thread Quincey Morris
On Sep 4, 2015, at 14:04 , Rick Mann  wrote:
> 
> Are my docs just broken, or are Xcode's docs not up-to-date with the language?

I don’t see the old ‘join’ documented anywhere, either in Xcode or on the 
developer web site. However, if I search the Xcode documentation for ‘join’, it 
lists several hits, all of which lead to documents that don’t list the method. 

Similarly, searching in Xcode for ‘joinWithSeparator’ produces no hits, but the 
documentation for ‘SequenceType’ does describe it.

Looks like a document indexing defect.



___

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

String.join()?

2015-09-04 Thread Rick Mann
According to the docs in Xcode 7b6, join(_:) is a method on String. But if I 
try to call it:

var str = "Hello, playground"
str.join(["foo","bar"])

error: 'join' is unavailable: call the 'joinWithSeparator()' method on the 
sequence of elements
str.join(["foo","bar"])
^~~~
Swift.String:3:8: note: 'join' has been explicitly marked unavailable here
  func join(elements: S) 
-> String

Of course, I can't command-click on join() to get to its declaration, and 
option-clicking on it doesn't link to its documentation.

Searching the documentation for joinWithSeparator turns up nothing.

Are my docs just broken, or are Xcode's docs not up-to-date with the language? 
Does code completion and jumping to declarations and finding docs via source 
code work for anyone else?

-- 
Rick Mann
rm...@latencyzero.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: NSView's in Separate NIB

2015-09-04 Thread Lee Ann Rucker
NSViewController doesn’t really work that way. It’s like an NSWindowController 
- it manages one view and handles all the nib unloading top-level objects stuff 
for you. (Trust me, you do not want to manage top-level objects yourself)

So instead of 

> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l
> myDetailViewController = [[LTWDetailViewController alloc] 
> initWithDetailView:theDetailView];

what you’d want is

myDetailViewController = [[LTWDetailViewController alloc] initWithNibName:@“ 
LTWDetailViewY”]
myDetailView = [myDetailViewController view];


On Sep 4, 2015, at 10:58 AM, Dave  wrote:

> 
>> On 4 Sep 2015, at 18:40, Conrad Shultz  wrote:
>> 
>> 
>>> On Sep 4, 2015, at 10:30 AM, Dave  wrote:
>>> 
>>> The reason I ask is that for a while now when you create an NSView subclass 
>>> it no longer offers you the option to create a separate NIB file. I 
>>> remember a while back reading something saying that it was frowned upon.
>>> 
>> 
>> You should be able to create a xib for an empty view, create an class file, 
>> and set the view's custom class in the xib.
>> 
>> I'm not sure about being frowned upon, but I would consider also creating an 
>> NSViewController subclass that is responsible for loading your view's nib, 
>> performing associated logic, and connecting it to the rest of your code.
> 
> I already have a View Controller I want to Pass in Views to it and have it 
> add them as subviews of the main view.
> 
> Basically I have a list of Detail Items with a Disclosure Triangle Button and 
> a Title for each one. 
> 
>> TITLEUndisclosed
> Subview is Not Shown
> 
> V TITLE   Disclosed
> Subview Is shown.
> 
> The idea is to create the View Controller for each item in code and pass in a 
> detail view to something like this:
> 
> 
> LTWDetailViewController*  myDetailViewController;
> LTWDetailView*myDetailView;
> 
> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewX”]l;
> myDetailViewController = [[LTWDetailViewController alloc] 
> initWithDetailView:theDetailView];
> 
> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l;
> myDetailViewController = [[LTWDetailViewController alloc] 
> initWithDetailView:theDetailView];
> 
> initWithDetailView creates an instance of the VC saves the LTWDetailView 
> passed to it in a property and then adds this view as a Subview (taking care 
> of any constraints (hopefully)).
> 
> 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/lrucker%40vmware.com
> 
> This email sent to lruc...@vmware.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: Auto Layout Problems

2015-09-04 Thread Gary L. Wade
As I mentioned, start with your stack view in your window, embed it in a scroll 
view using the menu command to do this, and add your constraints on the scroll 
view to position it within your window. It's easier and less error-prone if you 
do it this way. If you'd rather do it in code, do a search for a tutorial using 
NSScrollView Autolayout.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.com/

> On Sep 4, 2015, at 10:48 AM, Dave  wrote:
> 
> Hi,
> 
>> It seems your thread keeps changing subjects so it's been difficult to 
>> follow your troubles back to something at the start, or maybe something's 
>> gotten lost.
> 
> 
> What I’d dearly love to know right now is how to setup the Constraints for a 
> Scroll View and Clip View etc. in XCode/IB for Mac.
> 
> If I have a window in a NIB like this:
> 
> WindowInitially - Width=846, Height=594
>View
>ScrollViewInitially - X=20,Y=20, Width=806, 
> Height=554
>Flipped Clip View
>View
> 
> How do I set the constraints for the above Views in XCode/IB? 
> 
> I want the Scroll View to Stretch/Contract if the window is resized.
> 
> After this, I’d like to add a StackView to the Scroll View (in XCode/IB) and 
> have it Match the Size/Position of the Scroll View.
> 
> I’ve found (sketchy) articles describing how to it in XCode/IB for iOS and 
> I’’ve found (again sketchy) an article how to do it in Code for Mac.
> 
> Ideally I’d like to be able to do this and target 10.9 and using XCode 6.4.
> 
> 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: Auto Layout Problems

2015-09-04 Thread Luther Baker
I may not be following the entire thread very well - but as you likely
know, with autolayout, the scrollview's content size is literally
determined by its contents. It is generally simple to bind the scrollview
edges to the parent you mention but I think your next step is to properly
size the Stack View ... (child view) so that the ScrollView knows how big
to make it's content view.

On iOS, I can set width and height constraints between the child view and
its parent ScrollView's frame ... telling the child view to be the same
width and height as the ScrollView's frame. Note that these constraints are
not associated with the ScrollView's content view. Indeed, they drive the
content view's size. Think of it as the content view "reaching back" and
finding out how big it should be by constraining to sizes up the hierarchy.

I assume that model ports over to MacOS ... but I could be wrong.

Also, I'm guessing this bulletin was presented earlier but if not
https://developer.apple.com/library/ios/technotes/tn2154/_index.html

HTH,
-Luther




On Fri, Sep 4, 2015 at 12:48 PM, Dave  wrote:

> Hi,
>
> > It seems your thread keeps changing subjects so it's been difficult to
> follow your troubles back to something at the start, or maybe something's
> gotten lost.
>
>
> What I’d dearly love to know right now is how to setup the Constraints for
> a Scroll View and Clip View etc. in XCode/IB for Mac.
>
> If I have a window in a NIB like this:
>
> Window  Initially
> - Width=846, Height=594
> View
> ScrollView  Initially
> - X=20,Y=20, Width=806, Height=554
> Flipped Clip View
> View
>
> How do I set the constraints for the above Views in XCode/IB?
>
> I want the Scroll View to Stretch/Contract if the window is resized.
>
> After this, I’d like to add a StackView to the Scroll View (in XCode/IB)
> and have it Match the Size/Position of the Scroll View.
>
> I’ve found (sketchy) articles describing how to it in XCode/IB for iOS and
> I’’ve found (again sketchy) an article how to do it in Code for Mac.
>
> Ideally I’d like to be able to do this and target 10.9 and using XCode 6.4.
>
> 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/lutherbaker%40gmail.com
>
> This email sent to lutherba...@gmail.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: NSView's in Separate NIB

2015-09-04 Thread Dave

> On 4 Sep 2015, at 19:34, Marek Hrušovský  wrote:
> 
> How stuff work is the same. You want solution without using your brain.

There’s a big difference between UIView and NSView. I’m not sure what you mean 
by a “solution without using your brain”, but I already have a solution that I 
worked out a long time back before the days of Auto-Layout. I was just making 
sure it was still valid using later versions of Mac OS X and/or XCode is all. 
Obviously I’ll have to extend the View Subclass NIB loading code I wrote to 
handle Auto-Layout by overriding addSubview, but it shouldn’t be too difficult 
if I can get Auto-Layout to work in the first place that is!

Cheers
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: NSView's in Separate NIB

2015-09-04 Thread Marek Hrušovský
How stuff work is the same. You want solution without using your brain.

On Fri, Sep 4, 2015 at 8:18 PM, Dave  wrote:

> Thanks for this, I’m not sure how much of that article is iOS only, but
> I’ve done the NSView NIB loading trick in the past just not with
> Auto-Layout.
>
> All the Best
> Dave
>
>
> > On 4 Sep 2015, at 19:13, Marek Hrušovský  wrote:
> >
> > Please consider reading this (I don't code in swift/iOS but thats not
> and excuse):
> >
> >
> https://github.com/codepath/ios_guides/wiki/Custom-Views#how-views-are-defined-and-instantiated
> <
> https://github.com/codepath/ios_guides/wiki/Custom-Views#how-views-are-defined-and-instantiated
> >
> >
>
> ___
>
> 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/xhruso00%40gmail.com
>
> This email sent to xhrus...@gmail.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: Puzzling memory creep

2015-09-04 Thread Michael David Crawford
A memory pool will appear to be a leak however pools usually reach a
maximum size then stop growing.

Such a pool may be an internal implementation detail that is invisible
to your client code.

I don't know that your leak is really a pool however this is a common
false positive for leak detectors.
Michael David Crawford P.E., Consulting Process Architect
mdcrawf...@gmail.com
http://mike.soggywizard.com/

  One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To Light.


On Fri, Sep 4, 2015 at 9:13 AM,   wrote:
> So don't create a new for matter every time.
> Create one once outside of the timer.
> Formatters are heavy.
> Beyond that you might try judicious use of @autorelease{}
>
> Sent from my iPhone
>
>> On Aug 15, 2015, at 5:29 AM, Richard Kennaway  
>> wrote:
>>
>> I've written an iOS app that, according to Instruments, seems to very slowly 
>> allocate more and more memory over time, although I can see no reason for 
>> it.  After starting it, and letting it settle down, I see in the Allocations 
>> tool several entries in the "#Persistent" column creeping upwards.  
>> Typically, I see an item "CFArray (mutable-variable)" incrementing its 
>> #Persistent once a second, and an item "Malloc 32 Bytes" incrementing by 2 
>> every second.  The Leaks tool shows nothing.  Taking Generation snapshots at 
>> intervals of a second or two shows the steady accumulation of small 
>> allocations, described as .
>>
>> I'm using XCode 6.4 and running this in the simulator for iPhone 6 and iOS 
>> 8.4.  I've also tried the iPad2 and iOS 8.4 with similar results, although 
>> there the item that ticks up and up is "Malloc 64 bytes", at a rate of about 
>> 1 KB every 5 seconds.  The project is compiled with ARC turned on.  The high 
>> water mark of total memory use displayed in XCode increases by a megabyte in 
>> something over an hour and an overnight run shows no sign of it stopping.
>>
>> But I cannot see what is causing this.  It's a very small app, and if I let 
>> it run without interacting with it, the only code it executes is the 
>> following method of the single view controller, invoked by an NSTimer once a 
>> second to update a display of the time.
>>
>> - (void)updateTime {
>>NSDate *now = [NSDate date];
>>double seconds = [now timeIntervalSinceReferenceDate];
>>double intseconds = round(seconds);
>>now = [NSDate dateWithTimeIntervalSinceReferenceDate:intseconds];
>>
>>[dateFormatter setDateFormat:
>>[NSDateFormatter dateFormatFromTemplate:@"jjmmss" options: 0 locale: 
>> thelocale]];
>>[[self timestring] setText: [dateFormatter stringFromDate: now]];
>>
>>[dateFormatter setDateFormat:
>>[NSDateFormatter dateFormatFromTemplate:@"EEEdMMM" options: 0 locale: 
>> thelocale]];
>>[[self daystring] setText: [dateFormatter stringFromDate: now]];
>>
>>[dateFormatter setDateFormat:
>>[NSDateFormatter dateFormatFromTemplate:@"" options: 0 locale: 
>> thelocale]];
>>[[self yearstring] setText: [dateFormatter stringFromDate: now]];
>> }
>>
>> timestring, daystring, and yearstring are properties of my ViewController 
>> class connected to labels in the storyboard:
>>
>> @property (weak, nonatomic) IBOutlet UILabel *timestring;
>> @property (weak, nonatomic) IBOutlet UILabel *daystring;
>> @property (weak, nonatomic) IBOutlet UILabel *yearstring;
>>
>> dateFormatter and thelocale are private instance variables, initialised once 
>> in viewDidLoad().   I've also tried versions where these are variables local 
>> to updateTime(), and where "now" is an instance variable, but moving these 
>> around gives the same results.  I've also tried, with equal lack of effect, 
>> splitting up some of the one-liners into things like:
>>
>>NSString *thestring = [dateFormatter stringFromDate: now];
>>[[self timestring] setText: thestring];
>>
>> When the app is in the background it does nothing (it invalidates the 
>> NSTimer and sets the instance variable holding it to NULL), and Allocations 
>> reports no activity.
>>
>> What is causing this problem?  Instruments says the Responsible Library is 
>> libdispatch.dylib, and the Responsible Caller is 
>> _dispatch_continuation_alloc_from_heap.  The names suggest that this may be 
>> nothing to do with the code above.  Google turns up a small number of 
>> queries regarding memory leaks with similar symptoms, but no answers.
>>
>> --
>> Richard Kennaway
>>
>>
>> ___
>>
>> 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/dangerwillrobinsondanger%40gmail.com
>>
>> This email sent to dangerwillrobinsondan...@gmail.com
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.appl

Re: NSView's in Separate NIB

2015-09-04 Thread Dave
Thanks for this, I’m not sure how much of that article is iOS only, but I’ve 
done the NSView NIB loading trick in the past just not with Auto-Layout.

All the Best
Dave


> On 4 Sep 2015, at 19:13, Marek Hrušovský  wrote:
> 
> Please consider reading this (I don't code in swift/iOS but thats not and 
> excuse):
> 
> https://github.com/codepath/ios_guides/wiki/Custom-Views#how-views-are-defined-and-instantiated
>  
> 
> 

___

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: NSView's in Separate NIB

2015-09-04 Thread Marek Hrušovský
Please consider reading this (I don't code in swift/iOS but thats not and
excuse):

https://github.com/codepath/ios_guides/wiki/Custom-Views#how-views-are-defined-and-instantiated



On Fri, Sep 4, 2015 at 7:58 PM, Dave  wrote:

>
> > On 4 Sep 2015, at 18:40, Conrad Shultz  wrote:
> >
> >
> >> On Sep 4, 2015, at 10:30 AM, Dave  wrote:
> >>
> >> The reason I ask is that for a while now when you create an NSView
> subclass it no longer offers you the option to create a separate NIB file.
> I remember a while back reading something saying that it was frowned upon.
> >>
> >
> > You should be able to create a xib for an empty view, create an class
> file, and set the view's custom class in the xib.
> >
> > I'm not sure about being frowned upon, but I would consider also
> creating an NSViewController subclass that is responsible for loading your
> view's nib, performing associated logic, and connecting it to the rest of
> your code.
>
> I already have a View Controller I want to Pass in Views to it and have it
> add them as subviews of the main view.
>
> Basically I have a list of Detail Items with a Disclosure Triangle Button
> and a Title for each one.
>
> >  TITLEUndisclosed
> Subview is Not Shown
>
> V TITLE Disclosed
> Subview Is shown.
>
> The idea is to create the View Controller for each item in code and pass
> in a detail view to something like this:
>
>
> LTWDetailViewController*myDetailViewController;
> LTWDetailView*  myDetailView;
>
> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewX”]l;
> myDetailViewController = [[LTWDetailViewController alloc]
> initWithDetailView:theDetailView];
>
> myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l;
> myDetailViewController = [[LTWDetailViewController alloc]
> initWithDetailView:theDetailView];
>
> initWithDetailView creates an instance of the VC saves the LTWDetailView
> passed to it in a property and then adds this view as a Subview (taking
> care of any constraints (hopefully)).
>
> 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/xhruso00%40gmail.com
>
> This email sent to xhrus...@gmail.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: NSView's in Separate NIB

2015-09-04 Thread Dave

> On 4 Sep 2015, at 18:40, Conrad Shultz  wrote:
> 
> 
>> On Sep 4, 2015, at 10:30 AM, Dave  wrote:
>> 
>> The reason I ask is that for a while now when you create an NSView subclass 
>> it no longer offers you the option to create a separate NIB file. I remember 
>> a while back reading something saying that it was frowned upon.
>> 
> 
> You should be able to create a xib for an empty view, create an class file, 
> and set the view's custom class in the xib.
> 
> I'm not sure about being frowned upon, but I would consider also creating an 
> NSViewController subclass that is responsible for loading your view's nib, 
> performing associated logic, and connecting it to the rest of your code.

I already have a View Controller I want to Pass in Views to it and have it add 
them as subviews of the main view.

Basically I have a list of Detail Items with a Disclosure Triangle Button and a 
Title for each one. 

>  TITLEUndisclosed
Subview is Not Shown

V TITLE Disclosed
Subview Is shown.

The idea is to create the View Controller for each item in code and pass in a 
detail view to something like this:


LTWDetailViewController*myDetailViewController;
LTWDetailView*  myDetailView;

myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewX”]l;
myDetailViewController = [[LTWDetailViewController alloc] 
initWithDetailView:theDetailView];

myDetailView = [LTWDetailView loadViewFromNIB:@“ LTWDetailViewY”]l;
myDetailViewController = [[LTWDetailViewController alloc] 
initWithDetailView:theDetailView];

initWithDetailView creates an instance of the VC saves the LTWDetailView passed 
to it in a property and then adds this view as a Subview (taking care of any 
constraints (hopefully)).

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: Auto Layout Problems

2015-09-04 Thread Dave
Hi,

> It seems your thread keeps changing subjects so it's been difficult to follow 
> your troubles back to something at the start, or maybe something's gotten 
> lost.


What I’d dearly love to know right now is how to setup the Constraints for a 
Scroll View and Clip View etc. in XCode/IB for Mac.

If I have a window in a NIB like this:

Window  Initially - 
Width=846, Height=594
View
ScrollView  Initially - 
X=20,Y=20, Width=806, Height=554
Flipped Clip View
View

How do I set the constraints for the above Views in XCode/IB? 

I want the Scroll View to Stretch/Contract if the window is resized.

After this, I’d like to add a StackView to the Scroll View (in XCode/IB) and 
have it Match the Size/Position of the Scroll View.

I’ve found (sketchy) articles describing how to it in XCode/IB for iOS and 
I’’ve found (again sketchy) an article how to do it in Code for Mac.

Ideally I’d like to be able to do this and target 10.9 and using XCode 6.4.

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: NSView's in Separate NIB

2015-09-04 Thread Conrad Shultz

> On Sep 4, 2015, at 10:30 AM, Dave  wrote:
> 
> The reason I ask is that for a while now when you create an NSView subclass 
> it no longer offers you the option to create a separate NIB file. I remember 
> a while back reading something saying that it was frowned upon.
> 

You should be able to create a xib for an empty view, create an class file, and 
set the view's custom class in the xib.

I'm not sure about being frowned upon, but I would consider also creating an 
NSViewController subclass that is responsible for loading your view's nib, 
performing associated logic, and connecting it to the rest of your code.

-Conrad
___

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: NSView's in Separate NIB

2015-09-04 Thread Dave
The reason I ask is that for a while now when you create an NSView subclass it 
no longer offers you the option to create a separate NIB file. I remember a 
while back reading something saying that it was frowned upon.

Cheers
Dave

> On 4 Sep 2015, at 18:25, Conrad Shultz  wrote:
> 
> 
>> On Sep 4, 2015, at 9:23 AM, Dave  wrote:
>> 
>> Hi,
>> 
>> Is it still allowable (taking into consideration Auto Layout) to have a 
>> separate NSView subclass with a NIB?
>> 
> 
> Yes.
> 
> Auto Layout should be unrelated to this, though if you are composing your 
> separate views together in code then you will likely need to add constraints 
> in code (just as you might have to manually set frames in code under manual 
> layout).
> 
> -Conrad


___

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: NSView's in Separate NIB

2015-09-04 Thread Conrad Shultz

> On Sep 4, 2015, at 9:23 AM, Dave  wrote:
> 
> Hi,
> 
> Is it still allowable (taking into consideration Auto Layout) to have a 
> separate NSView subclass with a NIB?
> 

Yes.

Auto Layout should be unrelated to this, though if you are composing your 
separate views together in code then you will likely need to add constraints in 
code (just as you might have to manually set frames in code under manual 
layout).

-Conrad
___

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: Auto Layout Problems

2015-09-04 Thread Gary L. Wade
It seems your thread keeps changing subjects so it's been difficult to follow 
your troubles back to something at the start, or maybe something's gotten lost.

If you have a view in a XIB, you can usually choose to embed it in a scroll 
view (there's a menu item for that) which should take care of your issues, 
provided that view is the one which changes size.

If it doesn't, look at NSScrollView for a method named something like reflect 
document size change and call it after changing your view's size.

The scroll view and clip view work together to keep everything coordinated with 
the document view's size, which just refers to your sizable view that you 
embedded within a scroll view (a stack view if I've followed things correctly). 
Be very sure you need another view between them before adding one. If so, that 
should be the scroll view's document view and you should only handle changing 
its size.
--
Gary L. Wade (Sent from my iPhone)
http://www.garywade.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

NSView's in Separate NIB

2015-09-04 Thread Dave
Hi,

Is it still allowable (taking into consideration Auto Layout) to have a 
separate NSView subclass with a NIB?

Thanks
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: Puzzling memory creep

2015-09-04 Thread dangerwillrobinsondanger
So don't create a new for matter every time. 
Create one once outside of the timer. 
Formatters are heavy. 
Beyond that you might try judicious use of @autorelease{}

Sent from my iPhone

> On Aug 15, 2015, at 5:29 AM, Richard Kennaway  wrote:
> 
> I've written an iOS app that, according to Instruments, seems to very slowly 
> allocate more and more memory over time, although I can see no reason for it. 
>  After starting it, and letting it settle down, I see in the Allocations tool 
> several entries in the "#Persistent" column creeping upwards.  Typically, I 
> see an item "CFArray (mutable-variable)" incrementing its #Persistent once a 
> second, and an item "Malloc 32 Bytes" incrementing by 2 every second.  The 
> Leaks tool shows nothing.  Taking Generation snapshots at intervals of a 
> second or two shows the steady accumulation of small allocations, described 
> as .
> 
> I'm using XCode 6.4 and running this in the simulator for iPhone 6 and iOS 
> 8.4.  I've also tried the iPad2 and iOS 8.4 with similar results, although 
> there the item that ticks up and up is "Malloc 64 bytes", at a rate of about 
> 1 KB every 5 seconds.  The project is compiled with ARC turned on.  The high 
> water mark of total memory use displayed in XCode increases by a megabyte in 
> something over an hour and an overnight run shows no sign of it stopping.
> 
> But I cannot see what is causing this.  It's a very small app, and if I let 
> it run without interacting with it, the only code it executes is the 
> following method of the single view controller, invoked by an NSTimer once a 
> second to update a display of the time.
> 
> - (void)updateTime {
>NSDate *now = [NSDate date];
>double seconds = [now timeIntervalSinceReferenceDate];
>double intseconds = round(seconds);
>now = [NSDate dateWithTimeIntervalSinceReferenceDate:intseconds];
> 
>[dateFormatter setDateFormat:
>[NSDateFormatter dateFormatFromTemplate:@"jjmmss" options: 0 locale: 
> thelocale]];
>[[self timestring] setText: [dateFormatter stringFromDate: now]];
> 
>[dateFormatter setDateFormat:
>[NSDateFormatter dateFormatFromTemplate:@"EEEdMMM" options: 0 locale: 
> thelocale]];
>[[self daystring] setText: [dateFormatter stringFromDate: now]];
> 
>[dateFormatter setDateFormat:
>[NSDateFormatter dateFormatFromTemplate:@"" options: 0 locale: 
> thelocale]];
>[[self yearstring] setText: [dateFormatter stringFromDate: now]];
> }
> 
> timestring, daystring, and yearstring are properties of my ViewController 
> class connected to labels in the storyboard:
> 
> @property (weak, nonatomic) IBOutlet UILabel *timestring;
> @property (weak, nonatomic) IBOutlet UILabel *daystring;
> @property (weak, nonatomic) IBOutlet UILabel *yearstring;
> 
> dateFormatter and thelocale are private instance variables, initialised once 
> in viewDidLoad().   I've also tried versions where these are variables local 
> to updateTime(), and where "now" is an instance variable, but moving these 
> around gives the same results.  I've also tried, with equal lack of effect, 
> splitting up some of the one-liners into things like:
> 
>NSString *thestring = [dateFormatter stringFromDate: now];
>[[self timestring] setText: thestring];
> 
> When the app is in the background it does nothing (it invalidates the NSTimer 
> and sets the instance variable holding it to NULL), and Allocations reports 
> no activity.
> 
> What is causing this problem?  Instruments says the Responsible Library is 
> libdispatch.dylib, and the Responsible Caller is 
> _dispatch_continuation_alloc_from_heap.  The names suggest that this may be 
> nothing to do with the code above.  Google turns up a small number of queries 
> regarding memory leaks with similar symptoms, but no answers.
> 
> -- 
> Richard Kennaway
> 
> 
> ___
> 
> 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/dangerwillrobinsondanger%40gmail.com
> 
> This email sent to dangerwillrobinsondan...@gmail.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: Puzzling memory creep

2015-09-04 Thread Scott Ribe
On Sep 4, 2015, at 7:53 AM, Richard Kennaway  wrote:
> 
> It appears that __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
> does not relate to my updateTime() being invoked by the NSTimer, because 
> elsewhere under __CFRunLoopRun I see 
> __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__. Below that, the 
> tree reports:

I would not be surprised if that callback to an observer is something triggered 
by your updates--some part of the window event/update/redraw handling deep in 
the framework. I don't have any advice to offer as to how to get from that 
suspicion to a solution, sorry. But varying the frequency of your updates, and 
checking to see if that drives the rate of leakage through the observer 
callback, will at least establish if it's truly independent or correlated.

If it is correlated, then the prior suggestion of stripping down your update 
code bit by bit is a good one. I'd make one change though, first I'd remove 
*all* the code in the NSTimer callback. Find out if simply having a timer fire 
is enough, or if you have to actually do some updating--then if it doesn't leak 
with no code, start adding back gradually. And of course if it does leak with 
no code, you're ready to file a bug report and/or open a DTS incident.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice






___

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: Auto Layout Problems

2015-09-04 Thread Dave
Hi,

I’ve watched the videos at:

https://developer.apple.com/videos/wwdc/2015/?id=218 and 
https://developer.apple.com/videos/wwdc/2015/?id=219

Which I found generally very helpful except that the majority of it was for iOS 
not Mac OS X, and, there was nothing on how to make it work with an 
NSScrollView.

One thing that is interesting is that the main Sample App (AstroLayout) sets 
most if not all of the constraints in code. Is this the best way to go about 
it? Also its not clear how you use the new anchors in IB on the Mac.

I’m wondering if there will be some Mac specific sample code for this in the 
near future? (e.g. when 10.11 is released).

I was thinking of using a DTS incident, but I’m not sure this will help as Mac 
OS X 10.11 and XCode are Beta at present and I’m not sure if the answer will 
involve using them and according to the rules they also support released 
products.

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: How to intercept the space key in an NSTextField

2015-09-04 Thread Ken Thomases
On Jun 8, 2015, at 8:01 AM, Frank Bitterlich  wrote:

> I’m having trouble finding a solution for a seemingly simple problem.

This email is kind of old and just emerged from moderation limbo, but in case 
you're still stuck…

> I need an NSTextField that will „catch“ the space key, and instead of adding 
> a blank to its content, will trigger something different.
> 
> The reason: I have a window where I need to trigger starting/stopping of a 
> clock by pressing the spacebar, regardless of whether a text field currently 
> has the focus or not.

So, you don't need the text field to catch the space key, you need _something_ 
to catch it even if the text field has focus.

Try implementing -performKeyEquivalent: on the window or a high-level view 
within it.  Examine the event.  Do whatever is appropriate with respect to 
starting or stopping the clock if it meets your criteria (like it's a key-down 
for the Space key).  If it should be consumed, return YES.  Return NO for 
anything you don't handle.

If that doesn't work, try a local event monitor.  Create it using +[NSEvent 
addLocalMonitorForEventsMatchingMask:handler:].

Regards,
Ken


___

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

Converted mov to mp4, output file not working in default android video player

2015-09-04 Thread Devarshi Kulshreshtha
I used below code to convert an mov file to mp4 in my mac os x app:

- (IBAction)convertAction:(id)sender {

NSString *sampleMov = [@"~/Desktop/sample_mov.mov"
stringByExpandingTildeInPath];

AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:[NSURL
fileURLWithPath:sampleMov]
options:nil];

  //  NSArray *compatiblePresets = [AVAssetExportSession
exportPresetsCompatibleWithAsset:avAsset];

AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]
initWithAsset:avAsset presetName:AVAssetExportPresetPassthrough];

NSString *videoPath = [@"~/Desktop/sample_mp4_movie.mp4"
stringByExpandingTildeInPath];

exportSession.outputURL = [NSURL fileURLWithPath:videoPath];

NSLog(@"videopath of your mp4 file = %@",videoPath);  // PATH OF YOUR
.mp4 FILE

exportSession.outputFileType = AVFileTypeMPEG4;

 [exportSession exportAsynchronouslyWithCompletionHandler:^{

switch ([exportSession status]) {

 case AVAssetExportSessionStatusFailed:

NSLog(@"Export failed: %@", [[exportSession error]
localizedDescription]);

  break;

  case AVAssetExportSessionStatusCancelled:

NSLog(@"Export canceled");

   break;

  default: break;

}}];

}
Though it has successfully converted the file, the same file when sent to
an android device could not be played :(

Any ideas?

-- 
Thanks,

Devarshi
___

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