0

I want to append selectedtime value in timeworkLabelArray . But I am getting error Cannot invoke 'appendContentOf' with argument list of type (String,String)

var selectedTime = ("00", "00")
var timeWorkLabelArray = [String]()
timeWorkLabelArray.appendContentsOf(selectedTime)
1
  • selectedTime is not an array. You have to write like var selectedTime = ["00", "00"] Commented Apr 28, 2016 at 4:20

2 Answers 2

2

The array is declared as [String] but the argument is a tuple (String, String).

Either

var selectedTime = ["00", "00"]
var timeWorkLabelArray = [String]()
timeWorkLabelArray.appendContentsOf(selectedTime)

or

var selectedTime = ("00", "00")
var timeWorkLabelArray = [(String, String)]()
timeWorkLabelArray.append(selectedTime)
Sign up to request clarification or add additional context in comments.

Comments

0
var selectedTime = ["00", "00"]
var timeWorkLabelArray = [String]()
timeWorkLabelArray.appendContentsOf(selectedTime)

You can't append a tuple to an array declared as [String].

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.