Git Product home page Git Product logo

dbr-app's People

Watchers

 avatar  avatar

dbr-app's Issues

Add hardcoded DBR dates/scriptures

Create a Swift struct that has properties for every date where the value of that property is a list of scriptures for that day. I'd like it to be indexable by a date object. Also, remove the old service and code that requests this data from the api and point it at this data source.

See

Heres some pseudo code...

enum Book {
    // TODO: Add all books
    case genesis
    case exodus
    
    // ... NT...
    case matthew
    case mark
}

struct Scripture: Hashable {
    let book: Book
    let chapter: Int
}

struct Reading: Hashable {
    // A reading is a list of scriptures. A reading coresponds to a
    // single day in the DBR program.
    let scriptures: [Scripture]
}

struct Readings: Collection {
    
    // TODO: Possibly move this to a sepearate object so its not inside this
    // collection let this collection simply wrap access to that struct which
    // could only contain the data
    fileprivate let readings: [Date: Reading] = [
        // TODO: Complete list and use real dates
        Date(): Reading(scriptures: [
            Scripture(book: .genesis, chapter: 1),
            Scripture(book: .genesis, chapter: 2),
            Scripture(book: .matthew, chapter: 1)
        ]),
        Date(): Reading(scriptures: [
            Scripture(book: .genesis, chapter: 2),
            Scripture(book: .genesis, chapter: 3),
            Scripture(book: .matthew, chapter: 2)
        ])
    ]
    
    subscript(_ date: Date) -> Reading? {
        return self.readings[date]
    }
    
    var startIndex: Date {
        // TODO: Actually implement this. Start Index would likely be January 1??
        return Date()
    }
    
    var endIndex: Date {
        // TODO: Actually implement this. End index would likely be December 31??
        return Date()
    }
    
    func index(after: Date) -> Date {
        // TODO: Actually implement this. Given March 2nd return March 3rd
        return Date()
    }
    
}

HINT: Open up Xcode and create a new Playground and drop this into it and make changes and see how it works.

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.