Skip to content

Data associated type fixes 3.0 #661

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

Merged
merged 2 commits into from
Sep 29, 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
11 changes: 8 additions & 3 deletions Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
public typealias Base64DecodingOptions = NSData.Base64DecodingOptions

public typealias Index = Int
public typealias Indices = DefaultRandomAccessIndices<Data>
public typealias Indices = CountableRange<Int>

internal var _wrapped : _SwiftNSData

Expand Down Expand Up @@ -652,9 +652,9 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
}
}

public subscript(bounds: Range<Index>) -> MutableRandomAccessSlice<Data> {
public subscript(bounds: Range<Index>) -> MutableRangeReplaceableRandomAccessSlice<Data> {
get {
return MutableRandomAccessSlice(base: self, bounds: bounds)
return MutableRangeReplaceableRandomAccessSlice(base: self, bounds: bounds)
}
set {
replaceSubrange(bounds, with: newValue.base)
Expand All @@ -680,6 +680,11 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
public func index(after i: Index) -> Index {
return i + 1
}


public var indices: CountableRange<Int> {
return startIndex..<endIndex
}

/// An iterator over the contents of the data.
///
Expand Down