Skip to content

Instantly share code, notes, and snippets.

@dcangulo
Created February 3, 2022 11:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dcangulo/a93713c31a90d48d78298134f2c7bef4 to your computer and use it in GitHub Desktop.
React Native iOS MapView example in Swift
import { requireNativeComponent } from 'react-native';
export default requireNativeComponent('RNMap');
import Foundation
import AVFoundation
import MapKit
class RNMap : MKMapView {
}
#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
@interface RCT_EXTERN_MODULE(RNMapManager, RCTViewManager)
@end
import Foundation
@objc(RNMapManager)
class RNMapManager : RCTViewManager {
override class func requiresMainQueueSetup() -> Bool {
return true
}
override func view() -> UIView! {
return RNMap()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment