Giter VIP home page Giter VIP logo

Comments (3)

lukaskubanek avatar lukaskubanek commented on May 28, 2024

Do you expect to return the same text globally in the whole application for each of the methods or rather a build-in memory for keeping the strings around without the need to create variables?

from loremipsum.

erichoracek avatar erichoracek commented on May 28, 2024

Perhaps if when you instantiate a LoremIpsum object it would provide the same strings for each invocation of paragraph, sentence, and so on. You could then just hold onto that single object some place. Might make sense from an API design perspective: the class methods on LoremIpsum are randomized on each invocation and the equivalent instance methods are only randomized on instantiation of the LoremIpsum object. Just a thought!

from loremipsum.

lukaskubanek avatar lukaskubanek commented on May 28, 2024

when you instantiate

This is exactly what I don't want to do. The LoremIpsum should be just an in-place generator and should contain as little logic as possible. Therefore I don't like the idea of being able to instantiate objects of LoremIpsum.

When introducing a global lock on the class, there would be a problem when attempting to use methods not intended to be locked. A lock for individual methods would be an overkill.

I have two suggestions for you:

  1. You could either build a category on LoremIpsum for your particular use case and move the code with storing the generated string there.
  2. You can also generate the whole table structure at the beginning and store it in the view controller. Then you can use the already generated data in the UITableViewDataSource methods.

from loremipsum.

Related Issues (13)

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.