Search code examples
stringswiftsplitlocalizable.strings

Split string in multiples lines swift


I'm trying to split a string in multiple lines (such as the text of a song); I'm working in the localizable.strings. I'd like to do something like this:

"TITLE_SONG01" = "It's my life";
"SUBTITLE_SONG01" = "";
"TEXT_SONG01" = "It's my life" +
"is now or never";

but it doesn't work because data isn't in the correct format. Can anyone help me?


Solution

  • You can do that by inserting "\n" where you want the new line to start. For example:

    print("Hello\nWorld")
    

    Which will output the Hello on one line and World on another like this:

    Hello
    World