Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stdlib] Mark UnicodeScalar.utf16 and UnicodeScalar.UTF16View as public #4929

Merged
merged 2 commits into from
Sep 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions stdlib/public/core/UnicodeScalar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,29 +370,29 @@ extension UnicodeScalar : Comparable {
}

extension UnicodeScalar {
struct UTF16View {
var value: UnicodeScalar
public struct UTF16View {
internal var value: UnicodeScalar
}

var utf16: UTF16View {
public var utf16: UTF16View {
return UTF16View(value: self)
}
}

extension UnicodeScalar.UTF16View : RandomAccessCollection {

typealias Indices = CountableRange<Int>
public typealias Indices = CountableRange<Int>

/// The position of the first code unit.
var startIndex: Int {
public var startIndex: Int {
return 0
}

/// The "past the end" position---that is, the position one
/// greater than the last valid subscript argument.
///
/// If the collection is empty, `endIndex` is equal to `startIndex`.
var endIndex: Int {
public var endIndex: Int {
return 0 + UTF16.width(value)
}

Expand All @@ -401,7 +401,7 @@ extension UnicodeScalar.UTF16View : RandomAccessCollection {
/// - Parameter position: The position of the element to access. `position`
/// must be a valid index of the collection that is not equal to the
/// `endIndex` property.
subscript(position: Int) -> UTF16.CodeUnit {
public subscript(position: Int) -> UTF16.CodeUnit {
return position == 0 ? (
endIndex == 1 ? UTF16.CodeUnit(value.value) : UTF16.leadSurrogate(value)
) : UTF16.trailSurrogate(value)
Expand Down