Author Topic: Chapter 15 - overriding properties  (Read 5933 times)

Edward_JS

  • Newbie
  • *
  • Posts: 7
    • View Profile
Chapter 15 - overriding properties
« on: October 16, 2015, 06:18:01 PM »
when copying the code, I discovered that advance() is no longer available.
Xcode suggested using advancedBy().

I decided to take up the challenge, as how else can you learn but by trying?

Replace:

let index = advance(super.SSN.startIndex, 7)

with:

let index = super.SSN.startIndex.advancedBy(7)

if you then add code after , like:

var patient = = PatientSecureEntity()
patient.SSN

then you will get the result "***-**-6789" in the results window, as expected!

happy coding!

angelina

  • Global Moderator
  • *****
  • Posts: 25
    • View Profile
Re: Chapter 15 - overriding properties
« Reply #1 on: July 15, 2016, 12:11:16 PM »
Hello Edward_JS, Iíve looked into the issue you described. The advance() method was deprecated in Swift 2.  You are right, advancedBy() is the correct method to use.  Step #6 on page 251 shows the correct code, which does use advancedBy().


Angelina
Oak Leaf Enterprises, Inc.