Coder Social home page Coder Social logo

Comments (5)

EvanCooper9 avatar EvanCooper9 commented on June 21, 2024 1

@sohamb1390
Check the latest commit. I've added the ability to respond to touches.

  1. The signature of weekViewStylerEventView has changed. It's only the return type that has changed from UIView to WeekViewEventView.
  2. Conform to the WeekViewDelegate protocol and implement its only method: weekViewDidClickOnEvent.
  3. Assign the delegate property of your weekView instance to the relevant class.
  4. In the WeekView constructor, ensure to add the parameter respondsToInteraction and set it to true

Then you're good to go!

So far it's only a tap that activates the interaction, I'll work towards more functionality so you can choose what kind of gesture you want.

Let me know of any bugs that you find, it's a little hacky. Tt should work but I haven't done too much testing.
Thanks!

from swift-week-view.

sohamb1390 avatar sohamb1390 commented on June 21, 2024 1

Thanks a Lot Evan!
You saved my day. It's working like a charm.

Thanks Again!

from swift-week-view.

EvanCooper9 avatar EvanCooper9 commented on June 21, 2024

@sohamb1390
I'm working on this already, but am not ready to push to the repository. I plan to add a general touch-listener as a delegate function, but haven't gotten around to completing it. I can try to get it done soon.

To implement yourself, you should be able to use the weekViewStylerEventView method defined in the WeekViewStyler protocol. Perhaps try this:

  1. Implement the protocol and method above
  2. Create the view for the given event, and add a touch-listener to it
  3. Return the view to the protocol method

from swift-week-view.

sohamb1390 avatar sohamb1390 commented on June 21, 2024

Hi Evan,
I tried what you have suggested like this:

  1. I have implemented the method weekViewStylerEventView and inside it, I am returning views for individual events.

  2. I have added Tap gesture into each view:
    let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(onTapEventView(_:)))
    eventView.addGestureRecognizer(tapGestureRecognizer)

  3. I implemented the gesture method inside my viewController class:
    @objc func onTapEventView(_ gesture: UIGestureRecognizer) { print("tapped") }

But unfortunately it's not triggering this method whenever I am touching any event view.

Any idea?

from swift-week-view.

EvanCooper9 avatar EvanCooper9 commented on June 21, 2024

@sohamb1390
I think either one of the superviews of the eventView is highjacking the touch, or more likely its related to something in my logic for the scrollview behind it all. I'm having a look now.

from swift-week-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.