0xLet / SwiftUIKit

📱 UIKit code that is fun to write
https://0xlet.github.io/SwiftUIKit/
MIT License
74 stars 6 forks source link

Feature: Map #132

Closed Oschly closed 4 years ago

0xLeif commented 4 years ago

Closes #132

0xLeif commented 4 years ago

Function Parameter Naming convention

Example of correct naming: https://github.com/0xLeif/SwiftUIKit/blob/56da193939cf6a75eddd1c6a78cf5a7f03d34a19/Sources/SwiftUIKit/Views/WebView.swift#L76-L81

My preference for the first parameter name is to be required unless it is a closure.

Expected:

@available(iOS 11.0, *)
 extension Map {
   @discardableResult
   public func register(classes: [String: AnyClass?]) -> Self {
     for (identifier, annotationClass) in classes {
       register(annotationClass, forAnnotationViewWithReuseIdentifier: identifier)
     }

      return self
   }
 }

  // MARK: - Adjusting Map Regions and Rectangles
 extension Map {
   @discardableResult
   public func fit(region: MKCoordinateRegion) -> Self {
     self.region = regionThatFits(region)

      return self
   }

Actual:

@available(iOS 11.0, *)
 extension Map {
   @discardableResult
   public func register(_ classes: [String: AnyClass?]) -> Self {
     for (identifier, annotationClass) in classes {
       register(annotationClass, forAnnotationViewWithReuseIdentifier: identifier)
     }

      return self
   }
 }

  // MARK: - Adjusting Map Regions and Rectangles
 extension Map {
   @discardableResult
   public func fitTo(_ region: MKCoordinateRegion) -> Self {
     self.region = regionThatFits(region)

      return self
   }

P.S.

Mainly why I am against not requiring the first parameter name....

Swift 2.2 -> Swift 3 Changes

Oschly commented 4 years ago

Thanks for feedback! All of the suggestions are really good ideas. I will apply them to the branch tomorrow.

0xLeif commented 4 years ago

Looks good! I'm going to merge into feature/Map so the CI will actually run.