swift - RemoveAtIndex crashes playground -
swift - RemoveAtIndex crashes playground -
i'm trying remove character string using removeatindex func of string. crashes playground.
here total code:
let string = "some string" allow start = advance(string.startindex, 2) allow x = string.removeatindex(start)
you've declared string let makes immutable. since can phone call removeatindex on mutable string, can prepare declaring string var instead:
var string = "some string" allow start = advance(string.startindex, 2) allow x = string.removeatindex(start) note: above works in xcode 6.1, crashes compiler in xcode 6.0.
for xcode 6.0, using global removeatindex function instead works:
var string = "some string" allow start = advance(string.startindex, 2) allow x = removeatindex(&string, start) swift
Comments
Post a Comment