How to split SKLabelNodes into 2 Lines with Swift

1,053 views · Published 11 October 2017 · 11:50 · Indexed 14 November 2026

Channel: cartoonsmart · 2017 · Education

Watch on YouTube

In this video tutorial we'll look at some new Swift 4 code you can use if you are targeting iOS11 or higher that allows you to set the number of lines in an SKLabelNode. Yes that exists now. It was a long time coming. But we'll also look at the older way of doing this, by writing a convenience function that takes in two labels and splits one long text String into two Strings. We'll do this by iterating through the letters (characters) in the string and figuring out at what point we want to split it up.

More from this channel