I got the solution ||
ViewController.swift
var button = RideRequestButton()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let builder = RideParametersBuilder()
let pickupLocation = CLLocation(latitude: 37.787654, longitude: -122.402760)
let dropoffLocation = CLLocation(latitude: 37.775200, longitude: -122.417587)
builder.pickupLocation = pickupLocation
builder.dropoffLocation = dropoffLocation
builder.dropoffNickname = "Somewhere"
builder.dropoffAddress = "123 Fake St."
var productID = ""
let ridesClient = RidesClient()
ridesClient.fetchProducts(pickupLocation: pickupLocation) { (product, response) in
productID = product[1].productID!
builder.productID = productID
}
ridesClient.fetchPriceEstimates(pickupLocation: pickupLocation, dropoffLocation: dropoffLocation) { (price, response) in
print(price[0].estimate!)
self.button.rideParameters = builder.build()
self.button.loadRideInformation()
}
button.center = self.view.center
self.view.addSubview(button)
}
Also, do make little change into UberRides->RideRequestButton.swift`
override public func setContent() {
super.setContent()
uberMetadataLabel.numberOfLines = 0
uberMetadataLabel.sizeToFit()`
and
private func setMultilineAttributedString(title: String, subtitle: String = "", surge: Bool = false) {
let metadataFont = UIFont(name: "HelveticaNeue-Regular", size: 10) ?? UIFont.systemFont(ofSize: 10)
and last one change width (+30) of uberMetadataLabel below like
override public func sizeThatFits(_ size: CGSize) -> CGSize
var width: CGFloat = 4*horizontalEdgePadding + imageLabelPadding + logoSize.width + titleSize.width+30
If any query please comment here