Avatar
norio_nomura 2/13/2019 6:12 AM
5.0でStringProtocolIndex周りにconstraintsが増えて使いやすくなった。 4.2.2: protocol StringProtocol : BidirectionalCollection, Comparable, ExpressibleByStringLiteral, Hashable, LosslessStringConvertible, TextOutputStream, TextOutputStreamable where Self.Element == Swift.Character, Self.SubSequence : StringProtocol { associatedtype UTF8View : Collection where Self.UTF8View.Element == Swift.UInt8 associatedtype UTF16View : BidirectionalCollection where Self.UTF16View.Element == Swift.UInt16 associatedtype UnicodeScalarView : BidirectionalCollection where Self.UnicodeScalarView.Element == Swift.Unicode.Scalar 5.0: protocol StringProtocol : BidirectionalCollection, Comparable, ExpressibleByStringInterpolation, Hashable, LosslessStringConvertible, TextOutputStream, TextOutputStreamable where Self.Element == Swift.Character, Self.Index == Swift.String.Index, Self.StringInterpolation == Swift.DefaultStringInterpolation, Self.SubSequence : StringProtocol { associatedtype UTF8View : Collection where Self.UTF8View.Element == Swift.UInt8, Self.UTF8View.Index == Swift.String.Index, Self.SubSequence.UTF8View.Index == Swift.String.Index associatedtype UTF16View : BidirectionalCollection where Self.UTF16View.Element == Swift.UInt16, Self.UTF16View.Index == Swift.String.Index, Self.SubSequence.UTF16View.Index == Swift.String.Index associatedtype UnicodeScalarView : BidirectionalCollection where Self.UnicodeScalarView.Element == Swift.Unicode.Scalar, Self.UnicodeScalarView.Index == Swift.String.Index, Self.SubSequence.UnicodeScalarView.Index == Swift.String.Index associatedtype SubSequence = Swift.Substring