0

Im getting this error at

let encoded = akey.aesEncrypt(key: "hello", iv: "abc");

---> var data = "val1="+data1+"&val2="+data2+"&val3="+data3

What I'm I doing wrong ?

Please advice

techno
  • 6,100
  • 16
  • 86
  • 192
  • The marked question does not explain how to solve the string concatenation issue ...Is there a replacement for the '+' operator ? – techno Oct 09 '17 at 11:38
  • Did you try string *interpolation* (as suggested in an answer to the referenced question)? – Martin R Oct 09 '17 at 11:48
  • 1
    @MartinR For any one who might come across this question.This is a compiler issue with swift to do with '+' operator overloading.This can be solved by string interpolation e.g.:`var data="data1=\(value1)&data2=\(value2)&data3=\(value3)"` – techno Oct 09 '17 at 11:50
  • That is exactly what this answer https://stackoverflow.com/a/39514629/1187415 suggests: *"concatenating strings with interpolation ... is much better than ..."* – why do you think that it is not a duplicate or should be reopened? – Martin R Oct 09 '17 at 11:58
  • @MartinR That is a lengthy explanation and does not directly show an example to solve this ie:String Interpolation.I think an example would be helpful for beginners like me. – techno Oct 09 '17 at 12:00

0 Answers0