How do you structured-document closure parameters?

For example, the unlabeled one in hasAdfix here:

public extension Collection {
  /// Remove the beginning or end of a `Collection`.
  /// - Parameters:
  ///   - adfix: A prefix or suffix.
  ///   - hasAdfix: Whether a collection is adfixed by `adfix`.
  ///   - drop: Create a `SubSequence` by removing…
  ///    - count: …this many `Element`s.
  /// - Returns: `nil` if `hasAffix(affix)` is `false`.
  func without<Adfix: Sequence>(
    adfix: Adfix,
    hasAdfix: (Adfix) -> Bool,
    drop: (_ count: Int) -> SubSequence
  ) -> SubSequence?
  where Element == Adfix.Element {
    guard hasAdfix(adfix)
    else { return nil }

    return drop(adfix.count)
  }
}

Screen Shot 2020-09-09 at 10.02.26 AM

Related Issue (progress seems to have been made?): https://bugs.swift.org/browse/SR-3693

Terms of Service

Privacy Policy

Cookie Policy