• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift Beta 3 error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift Beta 3 error


  • Subject: Re: Swift Beta 3 error
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Tue, 08 Jul 2014 15:11:18 +0700

On 8 Jul 2014, at 14:39, Roland King <email@hidden> wrote:

>
>> On 8 Jul 2014, at 2:54 pm, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> This code used to work fine in Beta 2, but Beta 3 finds an error:
>>
>> var nbrOfThreads: UInt = ...
>> let theCounts = [UInt](count: Int(nbrOfThreads), repeatedValue: 0)
>>
>> dispatch_apply( nbrOfThreads, queue,
>> 	{	[unowned self] (idx: size_t) in
>> 		var localCount : UInt = 0
>> 		...
>> 		theCounts[ Int(idx) ] = localCount // Error: Could not find an overload for 'init' that accepts the supplied arguments
>> 	}
>> )
>>
>> What am I doing wrong again?
>>
>> Gerriet.
>>
>
> You really do need to read the release notes :)

I did. But I failed to connect my just acquired knowledge of the new array semantics with the error message.

>
> let theCounts = …
>
> immutable array. Change it to var theCounts ..

Did so, and now it compiles fine. But computes completely other (and wrong) results.
Well, more debugging to be done.

Thanks again for your help!

Kind regards

Gerriet.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Swift Beta 3 error
      • From: Roland King <email@hidden>
References: 
 >Swift Beta 3 error (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Swift Beta 3 error (From: Roland King <email@hidden>)

  • Prev by Date: Re: Swift Beta 3 error
  • Next by Date: Re: Swift Beta 3 error
  • Previous by thread: Re: Swift Beta 3 error
  • Next by thread: Re: Swift Beta 3 error
  • Index(es):
    • Date
    • Thread