I'm attempting to build SwiftFoundation using XCode 9.3. I've downloaded and am using the Swift 4.1 Toolchain. (Toolchain: Swift 4.1 Release 2018-03-29 (a))
I'm attempting to follow the instructions from Docs/GetttingStarted.md in the swift-corelibs-foundation repo.
I've tried to compile the latest which is from Mon Apr 2 commit 4deff496
. I've also attempted to compile a development snapshot swift-corelibs-foundation-swift-DEVELOPMENT-SNAPSHOT-2018-03-31-a
Both the current and the snapshot fail to build with 4 errors all the same message:
Value of type 'String' has no member '_guts'
in NSString in these methods:
internal func _fastCStringContents(_ nullTerminated: Bool) -> UnsafePointer<Int8>? {
if type(of: self) == NSString.self || type(of: self) == NSMutableString.self {
if _storage._guts._isContiguousASCII {
return unsafeBitCast(_storage._core.startASCII, to: UnsafePointer<Int8>.self)
}
}
return nil
}
internal var _fastContents: UnsafePointer<UniChar>? {
if type(of: self) == NSString.self || type(of: self) == NSMutableString.self {
if _storage._guts._isContiguousUTF16 {
return UnsafePointer<UniChar>(_storage._core.startUTF16)
}
}
return nil
}
internal var _encodingCantBeStoredInEightBitCFString: Bool {
if type(of: self) == NSString.self || type(of: self) == NSMutableString.self {
return !_storage._guts._isContiguousASCII
}
return false
}
public func getCString(_ buffer: UnsafeMutablePointer<Int8>, maxLength maxBufferCount: Int, encoding: UInt) -> Bool {
var used = 0
if type(of: self) == NSString.self || type(of: self) == NSMutableString.self {
if _storage._guts._isContiguousASCII {
used = min(self.length, maxBufferCount - 1)
_storage._core.startASCII.withMemoryRebound(to: Int8.self,
capacity: used) {
buffer.moveAssign(from: $0, count: used)
}
buffer.advanced(by: used).initialize(to: 0)
return true
}
}
if getBytes(UnsafeMutableRawPointer(buffer), maxLength: maxBufferCount, usedLength: &used, encoding: encoding, options: [], range: NSRange(location: 0, length: self.length), remaining: nil) {
buffer.advanced(by: used).initialize(to: 0)
return true
}
return false
}
I see this member _guts
was introduced recently in #1484.
Have I gone too quickly and overlooked some steps in the GettingStarted? Am I using the wrong ToolChain for latest code?