Giter Site home page Giter Site logo

Comments (10)

patchthecode avatar patchthecode commented on May 2, 2024

Does your issue look something like this?

screen shot 2016-06-12 at 5 38 36 pm

from jtapplecalendar.

yillivs avatar yillivs commented on May 2, 2024

Yes exactly like that.

from jtapplecalendar.

patchthecode avatar patchthecode commented on May 2, 2024

If it looks like that then, did you follow the step in the tutorial which has this code?

extension ViewController: JTAppleCalendarViewDataSource, JTAppleCalendarViewDelegate  {
    // Setting up manditory protocol method 
    func configureCalendar(calendar: JTAppleCalendarView) -> (startDate: NSDate, endDate: NSDate, numberOfRows: Int, calendar: NSCalendar) {
        // You can set your date using NSDate() or NSDateFormatter. Your choice.
        let formatter = NSDateFormatter()
        formatter.dateFormat = "yyyy MM dd"

        let firstDate = formatter.dateFromString("2016 01 05") 
        let secondDate = NSDate()
        let numberOfRows = 6
        let aCalendar = NSCalendar.currentCalendar() // Properly configure your calendar to your time zone here

        return (startDate: firstDate!, endDate: secondDate, numberOfRows: numberOfRows, calendar: aCalendar)
    }
}

from jtapplecalendar.

patchthecode avatar patchthecode commented on May 2, 2024

Remember, your calendar has to conform to the dataSource protocol. If it does not conform to the datasource, XCode will scream at you :)

from jtapplecalendar.

yillivs avatar yillivs commented on May 2, 2024

I believe so, I wrote this in the class same class as that manages the calendar view.

func configureCalendar(calendar: JTAppleCalendarView) -> (startDate: NSDate, endDate: NSDate, numberOfRows: Int, calendar: NSCalendar){

    let formatter = NSDateFormatter()//access to date formatter method
    formatter.dateFormat = "yyyy MM dd"

    let firstDate = formatter.dateFromString("2016 05 10")
    let secondDate = NSDate()
    let numberOfRows = 6

    let aCalendar = NSCalendar.currentCalendar()
    //return logical calendar for current user

    return(startDate: firstDate!, endDate: secondDate, numberOfRows: numberOfRows, calendar: aCalendar)
}

from jtapplecalendar.

yillivs avatar yillivs commented on May 2, 2024

But examining it currently I notice that I missed this line.

extension ViewController: JTAppleCalendarViewDataSource, JTAppleCalendarViewDelegate

Would that have caused this to occur?

from jtapplecalendar.

patchthecode avatar patchthecode commented on May 2, 2024

Yes. That is what caused the issue.

You should either have this:

class MonthViewController: UIViewController, JTAppleCalendarViewDataSource, JTAppleCalendarViewDelegate { 
...
...
...
}

Or this

extension ViewController: JTAppleCalendarViewDataSource, JTAppleCalendarViewDelegate 

Doing that tells the calendar that:

Yes, i conform to your required protocol

If you leave it out, then the calendar does not know that you conform to the protocol and XCode will scream at you.

It is your choice as to where you want to put it. I like putting mine in the extension to keep my code neat.
Once you insert that missing line, your error should go away

from jtapplecalendar.

patchthecode avatar patchthecode commented on May 2, 2024

Let me know if your issue is resolved. And if it is, then you can close this issue 👍

from jtapplecalendar.

yillivs avatar yillivs commented on May 2, 2024

That fixed it!

from jtapplecalendar.

patchthecode avatar patchthecode commented on May 2, 2024

awesome! Now go build a extremely cool looking calendar and post an image!
have a good one.

from jtapplecalendar.

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.