apple swift api design guideline
TRANSCRIPT
![Page 1: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/1.jpg)
Swift API Design Guidelinesby Apple Inc.
Sai Li @ Yowoo Tech. 2016 / 11 / 11
![Page 2: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/2.jpg)
Reference
• Apple Swift API Design Guidelines
• Function Naming In Swift 3
![Page 3: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/3.jpg)
Fundamentals
• Clarity at the point of use
• Clarity is more important than brevity
• Write a documentation comment
![Page 4: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/4.jpg)
Clarity at the point of use
![Page 5: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/5.jpg)
Clarity at the point of use
• Declared once but used repeatedly
![Page 6: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/6.jpg)
Clarity at the point of use
• Declared once but used repeatedly
• Clear and Concise
![Page 7: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/7.jpg)
Clarity at the point of use
• Declared once but used repeatedly
• Clear and Concise
• When evaluating a design, reading a declaration is seldom sufficient; always examine a use case to make sure it looks clear in context.
![Page 8: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/8.jpg)
Clarity is more important than brevity
![Page 9: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/9.jpg)
Clarity is more important than brevity
• non-goal to enable the smallest possible code fewest characters
![Page 10: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/10.jpg)
Clarity is more important than brevity
• non-goal to enable the smallest possible code fewest characters
• Brevity: a side-effect of the strong type system and features
![Page 11: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/11.jpg)
Write a documentation comment
![Page 12: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/12.jpg)
Write a documentation comment
• Every declaration
![Page 13: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/13.jpg)
Write a documentation comment
• Every declaration
• Don’t put it off
![Page 14: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/14.jpg)
Naming
![Page 15: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/15.jpg)
Promote Clear Usage• Include all the words needed to avoid ambiguity
![Page 16: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/16.jpg)
Promote Clear Usage• Include all the words needed to avoid ambiguity
![Page 17: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/17.jpg)
Promote Clear Usage• Include all the words needed to avoid ambiguity
![Page 18: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/18.jpg)
Omit needless words• Every word in a name should convey salient
information at the use site
![Page 19: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/19.jpg)
Omit needless words• Every word in a name should convey salient
information at the use site
redundant
![Page 20: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/20.jpg)
Name variables, parameters, and associated types according to their Roles• rather than their type
![Page 21: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/21.jpg)
Name variables, parameters, and associated types according to their Roles• rather than their type
![Page 22: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/22.jpg)
Name variables, parameters, and associated types according to their Roles• rather than their type
![Page 23: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/23.jpg)
Name variables, parameters, and associated types according to their Roles• rather than their type
![Page 24: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/24.jpg)
Name variables, parameters, and associated types according to their Roles• rather than their type
![Page 25: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/25.jpg)
Sometimes….
![Page 26: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/26.jpg)
Compensate for weak type information
![Page 27: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/27.jpg)
Compensate for weak type information• NSObject, Any, AnyObject, Int or String…
![Page 28: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/28.jpg)
Compensate for weak type information• NSObject, Any, AnyObject, Int or String…
• precede each weakly typed parameter with a noun describing its role
![Page 29: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/29.jpg)
Compensate for weak type information• NSObject, Any, AnyObject, Int or String…
• precede each weakly typed parameter with a noun describing its role
![Page 30: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/30.jpg)
Compensate for weak type information• NSObject, Any, AnyObject, Int or String…
• precede each weakly typed parameter with a noun describing its role
![Page 31: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/31.jpg)
Compensate for weak type information• NSObject, Any, AnyObject, Int or String…
• precede each weakly typed parameter with a noun describing its role
![Page 32: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/32.jpg)
Grammatical English Phrases
![Page 33: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/33.jpg)
Sometimes…
![Page 34: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/34.jpg)
Factory method & init()
![Page 35: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/35.jpg)
Factory method & init()• “make”:
![Page 36: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/36.jpg)
Factory method & init()• “make”:
• x.makeIterator()
![Page 37: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/37.jpg)
Factory method & init()• “make”:
• x.makeIterator()
• x.makeWidget(cogCount: 47)
![Page 38: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/38.jpg)
Factory method & init()• “make”:
• x.makeIterator()
• x.makeWidget(cogCount: 47)
![Page 39: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/39.jpg)
Factory method & init()• “make”:
• x.makeIterator()
• x.makeWidget(cogCount: 47)
![Page 40: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/40.jpg)
Factory method & init()• “make”:
• x.makeIterator()
• x.makeWidget(cogCount: 47)
![Page 41: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/41.jpg)
Factory method & init()• “make”:
• x.makeIterator()
• x.makeWidget(cogCount: 47)
![Page 42: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/42.jpg)
Factory method & init()• “make”:
• x.makeIterator()
• x.makeWidget(cogCount: 47)
![Page 43: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/43.jpg)
Side-effects
![Page 44: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/44.jpg)
Side-effects• Without: Noun
• x.distance(to: y) i.successor()
![Page 45: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/45.jpg)
Side-effects• Without: Noun
• x.distance(to: y) i.successor()
• With: Verb
• x.sort()x.append(y)
![Page 46: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/46.jpg)
Verb: Mutating / Nonmutating• “ed” or “ing”
![Page 47: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/47.jpg)
“ed”
![Page 48: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/48.jpg)
“ing”
![Page 49: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/49.jpg)
Noun: mutating/ nonmutating• “form”
![Page 50: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/50.jpg)
![Page 51: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/51.jpg)
• Booleaneg: x.isEmpty, line1.intersects(line2)
![Page 52: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/52.jpg)
• Booleaneg: x.isEmpty, line1.intersects(line2)
• Protocols what something is -> Noun eg: Collection
![Page 53: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/53.jpg)
• Booleaneg: x.isEmpty, line1.intersects(line2)
• Protocols what something is -> Noun eg: Collection
• Protocols: capability -> -able, -ible, -ingeg: Equatable, ProgressReporting
![Page 54: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/54.jpg)
• Booleaneg: x.isEmpty, line1.intersects(line2)
• Protocols what something is -> Noun eg: Collection
• Protocols: capability -> -able, -ible, -ingeg: Equatable, ProgressReporting
• types, properties, variables, and constants -> nouns.
![Page 55: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/55.jpg)
Term of Art
![Page 56: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/56.jpg)
Use Terminology Well
![Page 57: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/57.jpg)
Use Terminology Well• Avoid obscure terms
Don’t say “epidermis” if “skin” will serve your purpose
![Page 58: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/58.jpg)
Use Terminology Well• Avoid obscure terms
Don’t say “epidermis” if “skin” will serve your purpose
• Stick to the established meaning
Don’t surprise an expert
Don’t confuse a beginner
![Page 59: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/59.jpg)
Use Terminology Well• Avoid obscure terms
Don’t say “epidermis” if “skin” will serve your purpose
• Stick to the established meaning
Don’t surprise an expert
Don’t confuse a beginner
• Avoid “non-standard” abbreviations
easily found by a web search.
![Page 60: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/60.jpg)
Embrace precedent
• Array > List
• sin(x) > verticalPositionOnUnitCircleAtOriginOfEndOfRadiusWithAngle(x), sine(x)
• Precedent > Avoid abbreviation
![Page 61: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/61.jpg)
Conventions• Document the complexity of computed property > O(1)
![Page 62: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/62.jpg)
Conventions
![Page 63: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/63.jpg)
Conventionsmethods and properties > free functions
![Page 64: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/64.jpg)
Conventionsmethods and properties > free functions
1. No obvious self min(x, y, z)
![Page 65: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/65.jpg)
Conventionsmethods and properties > free functions
1. No obvious self min(x, y, z)
2. function is unconstrained generic print(x)
![Page 66: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/66.jpg)
Conventionsmethods and properties > free functions
1. No obvious self min(x, y, z)
2. function is unconstrained generic print(x)
3. function syntax is part of the domain notation sin(x)
![Page 67: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/67.jpg)
Follow case conventions
![Page 68: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/68.jpg)
Follow case conventions• Types and Protocols: UpperCamelCase
else: lowerCamelCase
![Page 69: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/69.jpg)
Follow case conventions• Types and Protocols: UpperCamelCase
else: lowerCamelCase
• var utf8Bytes: [UTF8.CodeUnit] var isRepresentableAsASCII = truevar userSMTPServer: SecureSMTPServer
![Page 70: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/70.jpg)
Follow case conventions• Types and Protocols: UpperCamelCase
else: lowerCamelCase
• var utf8Bytes: [UTF8.CodeUnit] var isRepresentableAsASCII = truevar userSMTPServer: SecureSMTPServer
• var radarDetector: RadarScanner var enjoysScubaDiving = true
![Page 71: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/71.jpg)
Methods can share a base name• Methods can share a base name
![Page 72: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/72.jpg)
Methods can share a base name• Methods can share a base name
![Page 73: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/73.jpg)
![Page 74: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/74.jpg)
![Page 75: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/75.jpg)
![Page 76: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/76.jpg)
![Page 77: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/77.jpg)
![Page 78: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/78.jpg)
Parameters
![Page 79: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/79.jpg)
![Page 80: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/80.jpg)
![Page 81: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/81.jpg)
![Page 82: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/82.jpg)
![Page 83: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/83.jpg)
![Page 84: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/84.jpg)
![Page 85: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/85.jpg)
![Page 86: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/86.jpg)
![Page 87: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/87.jpg)
Defaulted Parameters
![Page 88: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/88.jpg)
Defaulted Parameters
![Page 89: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/89.jpg)
Defaulted Parameters
![Page 90: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/90.jpg)
Defaulted Parameters
![Page 91: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/91.jpg)
Defaulted Parameters
![Page 92: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/92.jpg)
Defaulted Parameters
the end of the parameter list
![Page 93: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/93.jpg)
Argument Labels
• Omit all labels when arguments can’t be usefully distinguished
• Value preserving type conversions
![Page 94: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/94.jpg)
Argument Labels
• Omit all labels when arguments can’t be usefully distinguished
• Value preserving type conversions
![Page 95: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/95.jpg)
Argument Labels
![Page 96: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/96.jpg)
Argument Labels
![Page 97: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/97.jpg)
Argument Labels(narrowing)
![Page 98: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/98.jpg)
Argument Labels(narrowing)
![Page 99: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/99.jpg)
Monomorphism• value preserving type conversion
![Page 100: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/100.jpg)
Monomorphism
Int8 Int64
• value preserving type conversion
![Page 101: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/101.jpg)
Monomorphism
Int8 Int64
• value preserving type conversion
![Page 102: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/102.jpg)
Monomorphism
Int8 Int64
• value preserving type conversion
![Page 103: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/103.jpg)
Monomorphism
Int8 Int64
• value preserving type conversion
![Page 104: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/104.jpg)
Arguments Labels(prepositional phrase)
• eg: x.removeBoxes(havingLength: 12)
![Page 105: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/105.jpg)
Arguments Labels(prepositional phrase)
• eg: x.removeBoxes(havingLength: 12)
![Page 106: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/106.jpg)
Arguments Labels(prepositional phrase)
• eg: x.removeBoxes(havingLength: 12)
![Page 107: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/107.jpg)
Arguments Labels(prepositional phrase)
• eg: x.removeBoxes(havingLength: 12)
![Page 108: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/108.jpg)
• If the first argument forms part of a grammatical phrase, omit its label
![Page 109: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/109.jpg)
• If the first argument forms part of a grammatical phrase, omit its label
![Page 110: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/110.jpg)
• If the first argument forms part of a grammatical phrase, omit its label
![Page 111: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/111.jpg)
• If the first argument forms part of a grammatical phrase, omit its label
![Page 112: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/112.jpg)
• If the first argument forms part of a grammatical phrase, omit its label
![Page 113: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/113.jpg)
• If the first argument forms part of a grammatical phrase, omit its label
![Page 114: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/114.jpg)
• Label closure parameters and tuple members in your API.
![Page 115: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/115.jpg)
• Label closure parameters and tuple members in your API.
![Page 116: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/116.jpg)
• Label closure parameters and tuple members in your API.
![Page 117: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/117.jpg)
• Label closure parameters and tuple members in your API.
![Page 118: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/118.jpg)
Take extra care with unconstrained polymorphism
• eg: Any, AnyObject, unconstrained polymorphism
![Page 119: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/119.jpg)
Take extra care with unconstrained polymorphism
• eg: Any, AnyObject, unconstrained polymorphism
![Page 120: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/120.jpg)
Take extra care with unconstrained polymorphism
• eg: Any, AnyObject, unconstrained polymorphism
![Page 121: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/121.jpg)
Take extra care with unconstrained polymorphism
• eg: Any, AnyObject, unconstrained polymorphism
![Page 122: Apple Swift API Design Guideline](https://reader030.vdocument.in/reader030/viewer/2022021506/58735cab1a28abe7648b4c15/html5/thumbnails/122.jpg)
To be continued… Function Naming In Swift 3