Hi everyone,

I'm trying to follow some very simple code examples, and got this weird
situation with a playground:

//: Playground - noun: a place where people can play

import UIKit

let string = "a simple test"
if (string.characters.count > 0) {
    let words = string.components(separatedBy: " ")
    let headline = words.map { (var word) -> String in
        let firstCharacter = word.remove(at: word.startIndex)
        return "\(String(firstCharacter).uppercased())\(word)"
        }.joined(separator: " ")
}

This same code inside a func in a class on a normal project will generate a
segmentation fault error on xcode, when compiling the code.

Anyone has an idea of what is going wrong?

Regards,
LF
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to