[swift-users] xcode8 segmentation fault help

Luis Ferro lferro9000 at gmail.com
Tue Sep 27 04:51:09 CDT 2016

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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160927/9875ea63/attachment.html>

More information about the swift-users mailing list