This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:method: POST | |
:scheme: https | |
:path: /v1/motion-records?activityId=1311&deviceId=device_id&deviceMotionRecordId=device_motion_record_id&motionTypeId=1010&movementCount=10&name=record_name&status=COMPLETED | |
:authority: exp-ais-milfei.octonion.com | |
accept: */* | |
content-type: multipart/form-data; boundary=alamofire.boundary.9b685607dd401d7c | |
authorization: bearer 482315ba-4ad9-4749-aa78-77b7198d1376 | |
accept-encoding: gzip;q=1.0, compress;q=0.5 | |
user-agent: DataMiningApplication/1.0 (com.octonion.inhouse.DataMiningApplication; build:1; iOS 11.3.0) Alamofire/4.7.1 | |
content-length: 31837 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:method: POST | |
:scheme: https | |
:path: /v1/motion-records?activityId=784&deviceId=device_id&deviceMotionRecordId=device_motion_record_id&motionTypeId=605&movementCount=10&name=&status=completed | |
:authority: exp-ais-milfei.octonion.com | |
accept: */* | |
content-type: multipart/form-data; boundary=alamofire.boundary.aef675936694deaa | |
authorization: bearer e26150d7-4829-4b43-b9ba-93aac9f26db0 | |
accept-encoding: gzip;q=1.0, compress;q=0.5 | |
user-agent: DataMiningApplication/1.0 (com.octonion.inhouse.DataMiningApplication; build:1; iOS 11.3.0) Alamofire/4.7.1 | |
content-length: 19053 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:method: POST | |
:scheme: https | |
:path: /v1/motion-records?activityId=784&motionTypeId=605&movementCount=10&name= | |
:authority: exp-ais-milfei.octonion.com | |
accept: */* | |
content-type: multipart/form-data; boundary=alamofire.boundary.efac4053b38a155d | |
authorization: bearer e26150d7-4829-4b43-b9ba-93aac9f26db0 | |
accept-encoding: gzip;q=1.0, compress;q=0.5 | |
user-agent: DataMiningApplication/1.0 (com.octonion.inhouse.DataMiningApplication; build:1; iOS 11.3.0) Alamofire/4.7.1 | |
content-length: 74813 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rectangle = Rectangle(width: 42, height: 42) | |
let circle = Circle(radius: 42) | |
print(rectangle.accept(SquareShapeVisitor())) // 1764.0 | |
print(circle.accept(SquareShapeVisitor())) // 5541.77 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct SquareShapeVisitor: ShapeVisitor { | |
func visit(_ rectangle: Rectangle) -> Float { | |
return rectangle.width * rectangle.height | |
} | |
func visit(_ circle: Circle) -> Float { | |
return circle.radius * circle.radius * Float.pi | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Shape { | |
func accept<V: ShapeVisitor>(_ visitor: V) -> V.Result | |
} | |
struct Rectangle: Shape { | |
let width: Float | |
let height: Float | |
func accept<V: ShapeVisitor>(_ visitor: V) -> V.Result { | |
return visitor.visit(self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let square = rectangle.accept(SquareShapeVisitor()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rectangle = Rectangle(width: 42, height: 42) | |
let circle = Circle(radius: 42) | |
let squareVisitor = SquareShapeVisitor() | |
rectangle.accept(squareVisitor) | |
print(squareVisitor.square) // 1764.0 | |
circle.accept(squareVisitor) | |
print(squareVisitor.square) // 5541.77 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol ShapeVisitor { | |
func visit(_ rectangle: Rectangle) | |
func visit(_ circle: Circle) | |
} | |
protocol Shape { | |
func accept(_ visitor: ShapeVisitor) | |
} | |
struct Rectangle: Shape { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol Shape {} | |
struct Rectangle: Shape { | |
let width: Float | |
let height: Float | |
} | |
struct Circle: Shape { | |
let radius: Float | |
} |
NewerOlder