AliSoftware / AliSoftware/Reusable

MKMapView support

Đang mở
#103 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Swift
Star
3k
Fork
231
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

This library is obviously concentrated on `UITableView` and `UICollectionView` support but `MKMapView` has a lot of the same concepts: registering annotations and dequeuing them.

I currently use a simple extension for that

```swift
extension MKMapView {
final func register(annotationType: T.Type)
where T: Reusable {
self.register(annotationType.self, forAnnotationViewWithReuseIdentifier: annotationType.reuseIdentifier)
}

final func dequeueReusableAnnotation(annotationType: T.Type = T.self) -> T
where T: Reusable {
guard let view = self.dequeueReusableAnnotationView(withIdentifier: annotationType.reuseIdentifier) as? T else {
fatalError(
"Failed to dequeue a annotation view with identifier \(annotationType.reuseIdentifier) matching type \(annotationType.self). "
+ "Check that the reuseIdentifier is set properly in your XIB/Storyboard "
+ "and that you registered the annotation view beforehand"
)
}
return view
}
}
```

I wonder if you be willing to add `MKMapView` support. I can provide this extension as a PR together with some documentation and maybe even a sample.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.