5 Replies
      Latest reply on Mar 25, 2020 3:33 PM by OOPer
      ceh329 Level 1 Level 1 (0 points)

        Hello, I'm porting some of my old code to Swift and I'm running in to a little issue. I'm trying to get a range but I cant seem to get it all to work.

         

        My old Obj-C code was

         

        NSData *subData = [xData subdataWithRange:NSMakeRange(32, 16)];

         

        I'm not sure how to convert this to Swift 5. half-open range operator wont go in reverse. I tried

        .subdata(in: (16..<32).reverse() )

         

        But that did not work.

         

        Thanks!