ut I'm not
> in front of my computer and can't double-check.
>
> HTH
> - Dave Sweeris
>
> Sent from my iPhone
>
>> On Jan 16, 2017, at 10:11, Jean-Denis Muys via swift-users
>> mailto:swift-users@swift.org>> wrote:
>>
>> Hi,
>>
&
Hi,
I am exploring the use of Swift for a Mac Cocoa application - using Xcode
8.2.1, and it seems I hit a roadblock regarding Cocoa bindings.
In this toy Core Data document-based project, I added an NSArrayController in
the StoryBoard. I need to bind it a NSManagedObjectContext so that my user
Hi,
Using Xcode 8.2.1 I just created a brand new document-based Cocoa
application using Core Data and Swift. I created a single entity in the
Document.xcdatamodeld file. I selected "Class Definition" in the CodeGen
pop up menu in the inspector.
My entity is named PHAudioFile.
I then asked Xcode
Hi,
I defined this:
func random(from r: Range) -> Int {
let from = r.lowerBound
let to = r.upperBound
let rnd = arc4random_uniform(UInt32(to-from))
return from + Int(rnd)
}
so that I can do:
let testRandomValue = random(from: 4..<8)
But this will not let me do:
let other
So I suppose you feel this case is different from the (unsafe) implicitly
unwrapping of optionals with the “!” operator.
Why do you feel the situation is different?
> On 10 Oct 2016, at 17:34, Ole Begemann wrote:
>
>> When I declare my closure as @noescape, (the default), I explicitly tell
Thanks Ole,
You are perfectly right regarding the error message. For some reason, I misread
it. I am sorry about that.
The actual error message, as you point out, makes much more sense!
The rest of your explanation makes sense too, except:
When I declare my closure as @noescape, (the default),
return 2*result
> }
>
> let temp1 = closure(1)
> let temp2 = closureDoubled(1, closure2: closure)
> return temp1+temp2
> }
>
> Everything works as expected now. So I think the reason is just because of
> `closure` was not define in `fun
Here is a contrived reduction of my problem
func mainFunction(closure:(Int) -> Int) -> Int {
func closureDoubled(_ n: Int) -> Int {
let result = closure(n)
return 2*result
}
let temp1 = closure(1)
let temp2 = closureDoubled(1)
return temp1+temp2
}
The
ote:
>
>
>> On 3 Oct 2016, at 16:28, Jean-Denis Muys via swift-users
>> wrote:
>>
>> ASCII? Probably not. Latin? perhaps, though not obvious. For example French
>> accented letters would probably have to be handled somehow. Greek or
>> Cyrillic? Perhaps
Indeed,
But that function was just an example. I wanted to learn about how to use the
stack to call C functions that will fill some memory area passed as a pointer.
Jean-Denis
> On 3 Oct 2016, at 09:46, Quinn The Eskimo! via swift-users
> wrote:
>
>
> On 3 Oct 2016, at 01:14, Mike Ferendu
> On 3 Oct 2016, at 09:43, Quinn The Eskimo! via swift-users
> wrote:
>
>
> On 2 Oct 2016, at 19:02, Jean-Denis Muys via swift-users
> wrote:
>
>> The problem is, I could not find a simple way to convert from a character to
>> a unicodeScalar.
>
>
Hi,
Xcode seems to think that [some] builtins can be used from Swift. It
autocompletes popcount for example, and command-clicking the function opens
a bona fide interface file, with the following declaration (among others):
public func __builtin_popcount(_: UInt32) -> Int32
However, when I try t
Hi,
I have some issues using the new raw memory API. For instance, let's
suppose I want to call the `SecRandomCopyBytes` API to generate a
cryptographically secure random 32-bit number. The difficulty is its 3rd
argument, which is declared as UnsafeMutablePointer. Here is a
function that does that
I was playing with CharacterSet, and I came up with:
let vowels = CharacterSet(charactersIn: "AEIOU")
let char: Character = "E"
vowels.contains(char)
That last line doesn't compile: I get "*cannot convert value of type
'Character' to expected argument type 'UnicodeScalar'*"
The problem is, I
Hello,
I am struggling to convince Swift 3 (from Xcode 8 beta 6) to let me use an
array of Int as dictionary keys.
It doesn’t work out of the box, because an array is not hashable:
var answers: [[Int]:Bool] = [:] // error: Type [Int] does not conform to
Protocol Hashable
One way to work aroun
Hi,
Using Swift 3, I am in a situation where I need to construct an output array
step by step by picking (and possibly modifying) some item from an input array
(“consuming” that item, i.e. removing it from the input array).
That very easy to do by mutating “var” variables, using the append() an
Here is an outline on how you might achieve that.
1- Create a background GCD queue and a GCD semaphore.
2- dispatch_async your sort routine on that queue
3- add a call to dispatch_semaphore_wait before starting your sort. This will
grab the semaphore.
4- at the //wait here point, call dispatch_se
17 matches
Mail list logo