AliSoftware / AliSoftware/Reusable

MKMapView support

未關閉
#103 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Swift
星號
3k
分支
231
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。