ios - Tuple containing an array (and assigned as variable) not working? -


i trying create array of tuples in swift each tuple contains (1)letter , (2)array of custom objects, when try append throws error 'int' not convertible 't'.

here simplified code:

    var tuples : [(letter : character , objects : [myobject])] = []     //this works     tuples.append(letter:"test".firstchar(), objects: [myobject(), myobject()])     //gives error =>  'int' not convertable 't' on append function     var arrayofobjects : [myobject] = []     tuples.append(letter:"test".firstchar(), objects: arrayofobjects) 

this should work:

let arrayofobjects : [myobject] = [] tuples.append(letter:"t", objects: arrayofobjects) 

as can see, arrayofobjects constant. problem here might stem fact append expects constant parameter t, while passing tuple containing var. imho makes append goes little crazy, , compiler gives crazier error description ;-)


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -