Re: [swift-users] Why does this leak?

2017-03-27 Thread Rick Aurbach via swift-users
That wouldn’t work directly. The “leak” occurs when processing a segue called 
in response to a user button push. (I suppose I could attempt to wire up a UI 
Test, but would rather not go down that route.)

What I can try is to see if I can create a simple, artificial example. If it 
also reports a leak, then I could try looping it. I’ll look into it in the 
morning.

Cheers,

Rick Aurbach


> On Mar 27, 2017, at 6:11 PM, David Sweeris  wrote:
> 
> Could you call the supposedly leaky code a few million times and look at 
> memory usage to see if there's actually a leak?
> 
> - Dave Sweeris 
> 
> On Mar 27, 2017, at 13:31, Rick Aurbach via swift-users 
> > wrote:
> 
>> Okay, I downloaded the latest Xcode from the developer site. (The download 
>> page said it was 8.3beta5, but the version info called it 8.3 (8E161).)
>> 
>> So I put the use of the enum back into my code and profiled it again. 
>> (Please refer to my original post for the Case 1 code that I’m testing here.)
>> 
>> According to the Leaks Instrument, there is still a leak (just one 32-byte 
>> block, rather than two) coming from the call to prepare.
>> 
>> Unless I’m missing something REALLY basic here, using the enum as in my 
>> original post should not leak. (Right??) So either there is a compiler issue 
>> (still present in the compiler version of Xcode 8E161) or there is an issue 
>> in the Leaks Instrument (still present in the latest Xcode).
>> 
>> This is frustrating, because I don’t want to release a product with known 
>> leaks, but I don’t really know at this point whether I have one or whether 
>> I’m just seeing an artifact. Suggestions??
>> 
>> Cheers,
>> 
>> Rick Aurbach
>> 
>>> On Mar 27, 2017, at 3:01 AM, Alex Blewitt >> > wrote:
>>> 
>>> 
 On 26 Mar 2017, at 18:43, Rick Aurbach via swift-users 
 > wrote:
 
 I have a situation where I have a leak that I do not understand. I would 
 be very grateful if someone could explain it to me and offer an idea of 
 how I can make the pattern work without leaking:
>>> 
>>> How are you determining that this is leaking? There was an issue in Xcode 
>>> where the 'leaks' detector was unable to introspect the memory layout of a 
>>> Swift object containing an enum stored property and incorrectly flagging 
>>> other such reachable objects as leaks. If that's the case, do you still see 
>>> the same behaviour flagged in the latest Xcode?
>>> 
>>> Alex
>>> 
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org 
>> https://lists.swift.org/mailman/listinfo/swift-users 
>> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Why does this leak?

2017-03-27 Thread David Sweeris via swift-users
Could you call the supposedly leaky code a few million times and look at memory 
usage to see if there's actually a leak?

- Dave Sweeris 

> On Mar 27, 2017, at 13:31, Rick Aurbach via swift-users 
>  wrote:
> 
> Okay, I downloaded the latest Xcode from the developer site. (The download 
> page said it was 8.3beta5, but the version info called it 8.3 (8E161).)
> 
> So I put the use of the enum back into my code and profiled it again. (Please 
> refer to my original post for the Case 1 code that I’m testing here.)
> 
> According to the Leaks Instrument, there is still a leak (just one 32-byte 
> block, rather than two) coming from the call to prepare.
> 
> Unless I’m missing something REALLY basic here, using the enum as in my 
> original post should not leak. (Right??) So either there is a compiler issue 
> (still present in the compiler version of Xcode 8E161) or there is an issue 
> in the Leaks Instrument (still present in the latest Xcode).
> 
> This is frustrating, because I don’t want to release a product with known 
> leaks, but I don’t really know at this point whether I have one or whether 
> I’m just seeing an artifact. Suggestions??
> 
> Cheers,
> 
> Rick Aurbach
> 
>>> On Mar 27, 2017, at 3:01 AM, Alex Blewitt  wrote:
>>> 
>>> 
>>> On 26 Mar 2017, at 18:43, Rick Aurbach via swift-users 
>>>  wrote:
>>> 
>>> I have a situation where I have a leak that I do not understand. I would be 
>>> very grateful if someone could explain it to me and offer an idea of how I 
>>> can make the pattern work without leaking:
>> 
>> How are you determining that this is leaking? There was an issue in Xcode 
>> where the 'leaks' detector was unable to introspect the memory layout of a 
>> Swift object containing an enum stored property and incorrectly flagging 
>> other such reachable objects as leaks. If that's the case, do you still see 
>> the same behaviour flagged in the latest Xcode?
>> 
>> Alex
>> 
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Importing C system libraries

2017-03-27 Thread Josh Parmenter via swift-users
On Mar 27, 2017, at 2:10 PM, Jan Neumüller via swift-users 
 wrote:
> 
> Is it just me, or is Swift moving to much in a command line direction since 
> the open sourcing? I feel being left behind as an Xcode user...
> 
> Jan
> 


you can specify flags in Xcode - Xcode basically just wraps around command line 
tools anyways for the most part (when it comes to compiling)
Best,
Josh

>> On 27 Mar 2017, at 22:59, Michael Ilseman via swift-users 
>>  wrote:
>> 
>> Sure. At a low level, you can create a module.map file and use -L/-l flags 
>> in your invocation of Swift. If you want to do so at a higher level, then 
>> perhaps SwiftPM can. CCing swift-build-dev for the SwiftPM part.
>> 
>> 
>>> On Mar 26, 2017, at 3:20 PM, Kelvin Ma via swift-users 
>>>  wrote:
>>> 
>>> Idk if this has been asked before, but is there a way to import C libraries 
>>> into a Swift project without creating a local git repo? Preferably 
>>> something similar to C where you can just `#include` headers and then 
>>> specify the link flags (in Package.swift?) 
>>> 
>>> It’s getting very cumbersome to make a bunch of empty git repos just to use 
>>> libglfw or libcairo.
>>> ___
>>> swift-users mailing list
>>> swift-users@swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-users
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Importing C system libraries

2017-03-27 Thread Josh Parmenter via swift-users
On Mar 27, 2017, at 2:10 PM, Jan Neumüller via swift-users 
 wrote:
> 
> Is it just me, or is Swift moving to much in a command line direction since 
> the open sourcing? I feel being left behind as an Xcode user...
> 
> Jan
> 


you can specify flags in Xcode - Xcode basically just wraps around command line 
tools anyways for the most part (when it comes to compiling)
Best,
Josh

>> On 27 Mar 2017, at 22:59, Michael Ilseman via swift-users 
>>  wrote:
>> 
>> Sure. At a low level, you can create a module.map file and use -L/-l flags 
>> in your invocation of Swift. If you want to do so at a higher level, then 
>> perhaps SwiftPM can. CCing swift-build-dev for the SwiftPM part.
>> 
>> 
>>> On Mar 26, 2017, at 3:20 PM, Kelvin Ma via swift-users 
>>>  wrote:
>>> 
>>> Idk if this has been asked before, but is there a way to import C libraries 
>>> into a Swift project without creating a local git repo? Preferably 
>>> something similar to C where you can just `#include` headers and then 
>>> specify the link flags (in Package.swift?) 
>>> 
>>> It’s getting very cumbersome to make a bunch of empty git repos just to use 
>>> libglfw or libcairo.
>>> ___
>>> swift-users mailing list
>>> swift-users@swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-users
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Importing C system libraries

2017-03-27 Thread Michael Ilseman via swift-users
I don’t know what you’re referring to, but my solution also works for 
pre-open-source versions of Swift.

> On Mar 27, 2017, at 2:10 PM, Jan Neumüller  wrote:
> 
> Is it just me, or is Swift moving to much in a command line direction since 
> the open sourcing? I feel being left behind as an Xcode user...
> 
> Jan
> 
>> On 27 Mar 2017, at 22:59, Michael Ilseman via swift-users 
>>  wrote:
>> 
>> Sure. At a low level, you can create a module.map file and use -L/-l flags 
>> in your invocation of Swift. If you want to do so at a higher level, then 
>> perhaps SwiftPM can. CCing swift-build-dev for the SwiftPM part.
>> 
>> 
>>> On Mar 26, 2017, at 3:20 PM, Kelvin Ma via swift-users 
>>>  wrote:
>>> 
>>> Idk if this has been asked before, but is there a way to import C libraries 
>>> into a Swift project without creating a local git repo? Preferably 
>>> something similar to C where you can just `#include` headers and then 
>>> specify the link flags (in Package.swift?) 
>>> 
>>> It’s getting very cumbersome to make a bunch of empty git repos just to use 
>>> libglfw or libcairo.
>>> ___
>>> swift-users mailing list
>>> swift-users@swift.org
>>> https://lists.swift.org/mailman/listinfo/swift-users
>> 
>> ___
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Importing C system libraries

2017-03-27 Thread Jan Neumüller via swift-users
Is it just me, or is Swift moving to much in a command line direction since the 
open sourcing? I feel being left behind as an Xcode user...

Jan

> On 27 Mar 2017, at 22:59, Michael Ilseman via swift-users 
>  wrote:
> 
> Sure. At a low level, you can create a module.map file and use -L/-l flags in 
> your invocation of Swift. If you want to do so at a higher level, then 
> perhaps SwiftPM can. CCing swift-build-dev for the SwiftPM part.
> 
> 
>> On Mar 26, 2017, at 3:20 PM, Kelvin Ma via swift-users 
>>  wrote:
>> 
>> Idk if this has been asked before, but is there a way to import C libraries 
>> into a Swift project without creating a local git repo? Preferably something 
>> similar to C where you can just `#include` headers and then specify the link 
>> flags (in Package.swift?) 
>> 
>> It’s getting very cumbersome to make a bunch of empty git repos just to use 
>> libglfw or libcairo.
>> ___
>> swift-users mailing list
>> swift-users@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-users
> 
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Importing C system libraries

2017-03-27 Thread Michael Ilseman via swift-users
Sure. At a low level, you can create a module.map file and use -L/-l flags in 
your invocation of Swift. If you want to do so at a higher level, then perhaps 
SwiftPM can. CCing swift-build-dev for the SwiftPM part.


> On Mar 26, 2017, at 3:20 PM, Kelvin Ma via swift-users 
>  wrote:
> 
> Idk if this has been asked before, but is there a way to import C libraries 
> into a Swift project without creating a local git repo? Preferably something 
> similar to C where you can just `#include` headers and then specify the link 
> flags (in Package.swift?) 
> 
> It’s getting very cumbersome to make a bunch of empty git repos just to use 
> libglfw or libcairo.
> ___
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Why does this leak?

2017-03-27 Thread Rick Aurbach via swift-users
Okay, I downloaded the latest Xcode from the developer site. (The download page 
said it was 8.3beta5, but the version info called it 8.3 (8E161).)

So I put the use of the enum back into my code and profiled it again. (Please 
refer to my original post for the Case 1 code that I’m testing here.)

According to the Leaks Instrument, there is still a leak (just one 32-byte 
block, rather than two) coming from the call to prepare.

Unless I’m missing something REALLY basic here, using the enum as in my 
original post should not leak. (Right??) So either there is a compiler issue 
(still present in the compiler version of Xcode 8E161) or there is an issue in 
the Leaks Instrument (still present in the latest Xcode).

This is frustrating, because I don’t want to release a product with known 
leaks, but I don’t really know at this point whether I have one or whether I’m 
just seeing an artifact. Suggestions??

Cheers,

Rick Aurbach

> On Mar 27, 2017, at 3:01 AM, Alex Blewitt  wrote:
> 
> 
>> On 26 Mar 2017, at 18:43, Rick Aurbach via swift-users 
>>  wrote:
>> 
>> I have a situation where I have a leak that I do not understand. I would be 
>> very grateful if someone could explain it to me and offer an idea of how I 
>> can make the pattern work without leaking:
> 
> How are you determining that this is leaking? There was an issue in Xcode 
> where the 'leaks' detector was unable to introspect the memory layout of a 
> Swift object containing an enum stored property and incorrectly flagging 
> other such reachable objects as leaks. If that's the case, do you still see 
> the same behaviour flagged in the latest Xcode?
> 
> Alex
> 

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] withoutActuallyEscaping example question

2017-03-27 Thread Jordan Rose via swift-users

> On Mar 26, 2017, at 01:14, Slava Pestov via swift-users 
>  wrote:
> 
> Hi Ray,
> 
> There are two overloads of filter() available on ‘array.lazy’; the version 
> that takes an escaping closure and returns a LazyFilterCollection, and the 
> version that takes a non-escaping closure and returns [Int].
> 
> In the first example, we pick the LazyFilterCollection-returning overload, 
> because the literal closure { predicate($0) } can be coerced to both an 
> escaping or a non-escaping closure type, and in the absence of additional 
> constraints we go with the overload from a concrete type over an overload in 
> a protocol extension. After the overload has been picked we validate the body 
> of the closure, and notice that it is invalid because whole the closure is 
> already known to be @escaping, it references the non-@escaping ‘predicate’.
> 
> In the second example, ‘predicate’ is known to be non-@escaping, which rules 
> out the first overload completely, so we go with the second overload and 
> perform a non-lazy filter.
> 
> I would argue this is somewhat confusing, but it might be difficult to change 
> the overload resolution rules in a way where the first overload is always 
> chosen.

It seems like we could just not take escaping-ness into account at all, and 
only diagnose if it mismatches. We'd have to decide if we want that behavior, 
though.

Jordan

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


[swift-users] Access IOS music´s library

2017-03-27 Thread Eduardo Tavares via swift-users
Hi!


I was wondering if you guys could help me. I need to make an app that has 
access to user music´s library and export one of the music in there to whatsapp 
or any other message app.Does anyone know how I can do this or where I can get 
some examples of how to do this?



thank you very much

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


Re: [swift-users] Why does this leak?

2017-03-27 Thread Alex Blewitt via swift-users

> On 26 Mar 2017, at 18:43, Rick Aurbach via swift-users 
>  wrote:
> 
> I have a situation where I have a leak that I do not understand. I would be 
> very grateful if someone could explain it to me and offer an idea of how I 
> can make the pattern work without leaking:

How are you determining that this is leaking? There was an issue in Xcode where 
the 'leaks' detector was unable to introspect the memory layout of a Swift 
object containing an enum stored property and incorrectly flagging other such 
reachable objects as leaks. If that's the case, do you still see the same 
behaviour flagged in the latest Xcode?

Alex

___
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users