Question: In Swift... Write the MyString class that implements the CustomStringConvertible protocol. This class stores an Array of characters. It has two computed properties length and

In Swift... Write the MyString class that implements the CustomStringConvertible protocol. This class stores an Array of characters. It has two computed properties length and description. Create two initializers one takes in a String to initialize the character array and the other is just the default initializer which creates an empty character array. Add a subscript method for this class to access individual characters in the String do both get and set for subscript, if an index is specified beyond the end of the existing String just use last character in String. Also, write a += function for this class to append on another String.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!