Skip to content

Instantly share code, notes, and snippets.

@Francescu
Last active January 20, 2016 16:51
Show Gist options
  • Save Francescu/6ddaa22c9b699f3b170f to your computer and use it in GitHub Desktop.
Save Francescu/6ddaa22c9b699f3b170f to your computer and use it in GitHub Desktop.
String(contentsOfFile: "/test.txt")
/* OUTPUTS:
main.swift:2:17: note: overloads for 'String' exist with these partially matching parameter lists: (_StringCore), (Character), (String.CharacterView), (_builtinUnicodeScalarLiteral: Int32), (unicodeScalarLiteral: String), (extendedGraphemeClusterLiteral: String), (stringLiteral: String), (_storage: _StringBuffer), (S), (stringInterpolation: String...), (stringInterpolationSegment: T), (stringInterpolationSegment: String), (stringInterpolationSegment: Character), (stringInterpolationSegment: UnicodeScalar), (stringInterpolationSegment: Bool), (stringInterpolationSegment: Float32), (stringInterpolationSegment: Float64), (stringInterpolationSegment: UInt8), (stringInterpolationSegment: Int8), (stringInterpolationSegment: UInt16), (stringInterpolationSegment: Int16), (stringInterpolationSegment: UInt32), (stringInterpolationSegment: Int32), (stringInterpolationSegment: UInt64), (stringInterpolationSegment: Int64), (stringInterpolationSegment: UInt), (stringInterpolationSegment: Int), (UnicodeScalar), (T), (String.UnicodeScalarView), (String.UTF16View), (String.UTF8View), (reflecting: T)
*/
String(contentsOfFile: "/test.txt", usedEncoding: nil)
/* OUTPUTS:
main.swift:4:12: note: overloads for 'String' exist with these partially matching parameter lists: (_builtinUTF16StringLiteral: RawPointer, numberOfCodeUnits: Word), (count: Int, repeatedValue: Character), (count: Int, repeatedValue: UnicodeScalar), (T, radix: Int, uppercase: Bool)
*/
1> import Foundation
2> let test = String(contentsOfFile: "/test.txt")
fatal error: init(contentsOfFile:usedEncoding:) is not yet implemented: file Foundation/NSString.swift, line 1304
test: String = {
_core = {
_baseAddress = <extracting data from value failed>
_countAndFlags = <extracting data from value failed>
_owner = <extracting data from value failed>
}
}
Execution interrupted. Enter code to recover and continue.
Enter LLDB commands to investigate (type :help for assistance.)
3> let test = String(contentsOfFile: "/test.txt", encoding: 4)
test: String = "Test\n"
4>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment