Comments (4)
@RemcoB00 @Boris-Em Alright, I fixed my problem.
With Swift2+ even if you bridge nicely, you won't be able to have currentTimeOnClock
method working (no error and never called).
I just removed @optional
for this method only (BEMAnalogClockDelegate), I saw an error like No method declared with Objective-C selector
(error was silenced because this method is optional in the delegate).
The fix is simple:
@objc(currentTimeOnClock:Hours:Minutes:Seconds:)
func currentTimeOnClock(clock: BEMAnalogClockView!, hours: String!, minutes: String!, seconds: String!) {
print("currentTimeOnClock called")
}
Now it works even with Swift2+, if you:
- bridge (that was already known)
- add
@objc(currentTimeOnClock:Hours:Minutes:Seconds:)
from bemanalogclock.
You can use Objective-C code in your Swift project by using a bridging header file (see the Apple website for more details). I use this project in my Swift app and it works great.
from bemanalogclock.
Thank you @RemcoB00 for confirming that it works with Swift.
from bemanalogclock.
@RemcoB00 @Boris-Em Did it work on a swift application?
It seems like currentTimeOnClock
is never called in my test application in Swift.
Strange since other delegate methods like clockDidBeginLoading
get called
Here is my code:
class ViewController: UIViewController, BEMAnalogClockDelegate {
@IBOutlet weak var clock: BEMAnalogClockView!
override func viewDidLoad() {
super.viewDidLoad()
self.clock.delegate = self
self.clock.realTime = true
self.clock.currentTime = true
self.clock.setTimeViaTouch = true
self.clock.enableDigit = true
}
func clockDidBeginLoading(clock: BEMAnalogClockView!) {
print("clockDidBeginLoading called")
}
func clockDidFinishLoading(clock: BEMAnalogClockView!) {
print("clockDidFinishLoading called")
}
func currentTimeOnClock(clock: BEMAnalogClockView!, hours: String!, minutes: String!, seconds: String!) {
print("currentTimeOnClock called")
}
result:
clockDidBeginLoading called
clockDidFinishLoading called
from bemanalogclock.
Related Issues (17)
- Border Color and Graduation Color do not update HOT 9
- Hours HOT 6
- Issue with delegate and Graduation Methods.... HOT 3
- showing 24h time HOT 7
- Second Hand lags when scrolling HOT 3
- hour hand x-offset (off center) in some conditions HOT 11
- hour hands have a bug when scroll HOT 2
- Possible to shorten opposite clock hand? HOT 2
- Add more customization options HOT 1
- The Pointer deviation HOT 1
- tvOS support HOT 1
- enabledShadows does not work HOT 2
- hand frame is incorrect HOT 2
- Clock timer stop when screen become dark HOT 1
- The hands don't change size according to auto layout constraints like the clock itself does HOT 9
- The sample project looks weird... HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bemanalogclock.