File tree 2 files changed +8
-10
lines changed
SwiftWisdom/Core/Foundation/Data
2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 1
1
Pod ::Spec . new do |s |
2
2
s . name = "Intrepid"
3
- s . version = "0.13.1 "
3
+ s . version = "0.13.2 "
4
4
s . summary = "Swift Bag"
5
5
s . description = <<-DESC
6
6
Collection of extensions and utility classes by and for the developers at Intrepid Pursuits.
Original file line number Diff line number Diff line change @@ -142,17 +142,15 @@ extension Data {
142
142
143
143
extension Data {
144
144
public func ip_segmentIterator( start: Int = 0 , chunkLength: Int ) -> AnyIterator < Data > {
145
- let segmentToWrite = ip_suffix ( from: start)
146
- var mutable = segmentToWrite
147
- let range = 0 ..< chunkLength
145
+ var iteratedData = ip_suffix ( from: start)
148
146
return AnyIterator {
149
147
let nextData : Data ?
150
- if let remaining = mutable , remaining. count >= chunkLength {
151
- nextData = mutable ? [ ip_safely : range ]
152
- mutable ? . removeSubrange ( range )
153
- } else if let remaining = mutable , remaining. count > 0 {
154
- nextData = mutable
155
- mutable ? . count = 0
148
+ if let remaining = iteratedData , remaining. count >= chunkLength {
149
+ nextData = remaining . prefix ( chunkLength )
150
+ iteratedData ? . removeFirst ( chunkLength )
151
+ } else if let remaining = iteratedData , remaining. count > 0 {
152
+ nextData = remaining
153
+ iteratedData ? . removeAll ( )
156
154
} else {
157
155
nextData = nil
158
156
}
You can’t perform that action at this time.
0 commit comments