jpdriver / pure-swift-views-react-native Goto Github PK
View Code? Open in Web Editor NEWVending pure-Swift views in React Native
Vending pure-Swift views in React Native
"dependencies": {
"react": "16.0.0",
"react-native": "0.51.0"
},
xcode 9.2
Works as expected with your (older) settings, but not for the life of me I can get it to work now.
Thank you in advance!
Uli
Can we create a package (for instance, react-native-sample-view) using Swift?
// SwiftStreetVueController.swift
import UIKit
import GoogleMaps
class SwiftStreetVueController: UIViewController, GMSPanoramaViewDelegate {
override func loadView() {
let bounda = UIScreen.main.bounds
let width = bounda.size.width
let height = bounda.size.height
let panoView = GMSPanoramaView(frame: CGRect(x: 0, y: 0, width: width,
height: height-60))
panoView.setAllGesturesEnabled(true)
panoView.moveNearCoordinate(CLLocationCoordinate2DMake(38.4476364, -123.3953934))
panoView.delegate = self
self.view = panoView
}
// MARK: - GMSPanoramaViewDelegate
private func panoramaView(view: GMSPanoramaView!, error: NSError!, onMoveNearCoordinate coordinate: CLLocationCoordinate2D) {
print("Moving near coordinate (\(coordinate.latitude),\(coordinate.longitude) error: \(error.localizedDescription)")
}
private func panoramaView(view: GMSPanoramaView!, error: NSError!, onMoveToPanoramaID panoramaID: String!) {
print("Moving to PanoID \(panoramaID) error: \(error.localizedDescription)")
}
private func panoramaView(view: GMSPanoramaView!, didMoveToPanorama panorama: ``GMSPanorama!) {
print("Moved to panoramaID: \(panorama.panoramaID) " +
"coordinates: (\(panorama.coordinate.latitude),\(panorama.coordinate.longitude))")
}
}
`// SwiftStreetVue.swift
import UIKit
import GoogleMaps
class SwiftStreetVue: UIView {
let StreetVueController: SwiftStreetVueController = SwiftStreetVueController()
override init(frame: CGRect) {
super.init(frame: frame)
self.reactAddController(toClosestParent: StreetVueController)
self.addSubview(StreetVueController.view)
}
required init(coder aDecoder: NSCoder) {
fatalError("This class does not support NSCoding")
}
}
`
`// SwiftStreetVueManager.swift
import Foundation
@objc(SwiftStreetVueManager)
class SwiftStreetVueManager : RCTViewManager {
override func view() -> UIView! {
return SwiftStreetVue();
}
}
`
I can't touch or click my view. how can i do it?
Very cool thank you so much for this repo and your article https://medium.com/@jpdriver/vending-pure-swift-views-in-react-native-3f417349e3c6
May you guide us on how to add a prop like "label" which allows us to control the "This is Swift" text?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.