twho / loading-buttons-ios Goto Github PK
View Code? Open in Web Editor NEWA collection of loading buttons and their stylings written in Swift.
License: MIT License
A collection of loading buttons and their stylings written in Swift.
License: MIT License
If you call showLoader() and hideLoader() in quick succession (less than 0.18 seconds apart) the hideLoader() function will not be executed due to the transition animation of 0.2 seconds you've put. This should not happen and a smooth transition should be granted no matter what.
There are workarounds to this using the showLoader closure but I think it should be fixed and taken into account anyways.
Other than this, great work on the repo! Good job!
Start loading in GoogleMap function
extension homeViewController: GMSMapViewDelegate
{
func mapView(_ mapView: GMSMapView, idleAt position: GMSCameraPosition) {
if self.textFieldname == "pickup"
{
if confirmPickUpbtn.isLoading
{
}
else
{
confirmPickUpbtn.isLoading = true
confirmPickUpbtn.showLoader(userInteraction: false)
}
}
else if self.textFieldname == "dropoff"
{
if confirmDropoffbtn.isLoading
{
}
else
{
confirmDropoffbtn.isLoading = true
confirmDropoffbtn.showLoader(userInteraction: false)
}
}
// let camera = GMSCameraPosition.camera(withLatitude: (position.target.latitude), longitude: (position.target.longitude), zoom: 18.0 , bearing: 0, viewingAngle: 0)
// self.mapView?.animate(to: camera)
reverseGeocodeCoordinate(position.target)
}
}
End in reverseGeocodeCoordinate function
private func reverseGeocodeCoordinate(_ coordinate: CLLocationCoordinate2D) {
// 1
let geocoder = GMSGeocoder()
// 2
geocoder.reverseGeocodeCoordinate(coordinate) { response, error in
guard let address = response?.firstResult(), let lines = address.lines else {
return
}
// 3
if self.textFieldname == "pickup"
{
### if self.confirmPickUpbtn.isLoading
{
self.confirmPickUpbtn.isLoading = false
self.confirmPickUpbtn.hideLoader()
self.confirmPickUpbtn.backgroundColor = UIColor(hexString: "#FFCF00")
}
current_lat = coordinate.latitude
current_long = coordinate.longitude
self.startLocTextF.text = lines.joined(separator: "\n")
self.locationManager.stopUpdatingLocation()
}
else if self.textFieldname == "dropoff"
{
if self.confirmDropoffbtn.isLoading
{
self.confirmDropoffbtn.isLoading = false
self.confirmDropoffbtn.hideLoader()
self.confirmDropoffbtn.backgroundColor = UIColor(hexString: "#FFCF00")
}
desition_lat = coordinate.latitude
desition_long = coordinate.longitude
self.endLocTextF.text = lines.joined(separator: "\n")
self.locationManager.stopUpdatingLocation()
}
// 4
UIView.animate(withDuration: 0.25) {
self.view.layoutIfNeeded()
}
}
}
Button Action code
@IBAction func conformpickup(_ sender: LoadingButton) {
sender.isLoading ? sender.hideLoader() : sender.showLoader(userInteraction: true)
DispatchQueue.main.async {
self.confirmPickUpbtn.backgroundColor = UIColor(hexString: "#FFCF00")
}
}
STEPS
hideLoader
from background thread. aka when you return from an API asyncEXPECTED:
hideLoader
's UI calls would be wrapped in a DispatchQueue.main.async { }
, so that the callers don't need to do that?ACTUAL:
Wouldn't happen to have a working SwiftUI version? Great job by the way ๐
It works fine in Simulator,When trying to build and archive with generic ios device,it's giving the following error
Could not find module 'LoadingButtons' for target 'arm64-apple-ios'; found: x86_64-apple-ios-simulator, x86_64.Added x86_64 in valid architectures but it's not working
Hi,
I am using this pod when i click the button background color is changed but i don't want change the background
color
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.