selectAppleSlice function

AppleSliceCandidate? selectAppleSlice(
  1. Iterable<AppleSliceCandidate> candidates,
  2. AppleSliceRequest request
)

Selects an XCFramework entry without relying on directory enumeration order.

Implementation

AppleSliceCandidate? selectAppleSlice(
  Iterable<AppleSliceCandidate> candidates,
  AppleSliceRequest request,
) {
  final compatible = candidates.where(
    (candidate) => candidate.supports(request),
  );
  return compatible.isEmpty
      ? null
      : (compatible.toList()
              ..sort((a, b) => a.identifier.compareTo(b.identifier)))
            .first;
}