0

So I want to create a list of functions that have no parameters and return void, how do I do this?

This is what I have so far:

var levels: [() -> ()] = [() -> ()]()

But this just gives me a "Expected ',' seperator" Error

Anyone know how to do this?

0

1 Answer 1

0

As far as I can tell that should work. It looks like the problem is where you initialize the array:

[() -> ()]()

I've tried that in Xcode 6.0.1 and Xcode 6.0 GM and it fails in both places. A workaround is to use the Array<T> syntax instead:

var levels: [() -> ()] = Array<() -> ()>()

Edit: This also works:

var levels: [() -> ()] = []
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.