At Pandora all of our legacy iOS code is written in Objective-C (using ARC),
however all new classes/features/work will be written in Swift. In this
scenario, you are refactoring a legacy Objective-C file to be more readable.
There is a function createSoftButtonWithIdentifier. It takes three
arguments: identifier, text and iconValue -- all of which will only ever
be used together {id:@1, text: @"List", iconValue: @"list_icon"} -- there
are no circumstances under which the arguments will be mixed up.
- (SoftButton *) createSoftButtonWithIdentifier:(NSNumber *)identifier
andText:(NSString *)text
andIconValue:(NSString *)value;- How would you improve this by creating a structured data object to group the values together?
- You may change the function's signature to take your new type.
createSoftButtonWithIdentifierfunction must live in the Obj-C class/cannot be rewritten in Swift.
You may use Objective-C, C or Swift as long as the Swift types translate to Objective-C.
- How/what would you want to write an XCTestCase unit-test for?
- Test can be in Objective-C or Swift.