GithubHelp home page GithubHelp logo

uninstall() is internal about snapkit HOT 9 CLOSED

snapkit avatar snapkit commented on May 3, 2024
uninstall() is internal

from snapkit.

Comments (9)

cnoon avatar cnoon commented on May 3, 2024

The README describes you use case. Here is a section taken directly from it.

var topConstraint: Constraint? = nil

...

// when making constraints
view1.snp_makeConstraints { make in
  self.topConstraint = make.top.equalTo(superview).with.offset(padding.top)
  make.left.equalTo(superview).with.offset(padding.left)
}

...
// then later you can call
self.topConstraint.uninstall()

In the future I would suggest you read through the entire README of an open source project before posting usage and design questions. It will certainly save yourself and others time and frustration.

Hope that helps!

from snapkit.

allen-zeng avatar allen-zeng commented on May 3, 2024

Thanks for your comment.

If you read the question a bit more closely, it's actually about the fact that uninstall() is marked as internal.

The excerpt is what I used as my reference point. Except

  • because topConstraint is an Optional so you'd have to unwrap it before calling uninstall()
  • coming back to the question, because uninstall() is marked as internal, it can't actually be called from outside of the framework.

So to expand a bit more on my question: are there reasons why we might not want to expose uninstall() publicly? For example, setups required, unintended side effects etc.? If not, then we'll have to update the access modifier to public

from snapkit.

cnoon avatar cnoon commented on May 3, 2024

Hey @allen-zeng, sorry about that. I totally read your question way too fast. You make all great points.

The README example is definitely wrong. You definitely would have to unwrap the topConstraint before calling uninstall(). Additionally, it wouldn't compile anyways since uninstall is not public.

@robertjpayne do you have some thoughts here? I'm assuming we'll need to make the uninstall method public, but what about the install method then? It seems weird to only have uninstall marked as public.

from snapkit.

robertjpayne avatar robertjpayne commented on May 3, 2024

Hey @allen-zeng @cnoon in the last update I marked these two methods as internal due to the fact they really shouldn't be used in their current state given they don't clean up properly.

I'll try and get around to this ASAP as in hindsight this wasn't probably a good idea.

from snapkit.

cnoon avatar cnoon commented on May 3, 2024

Sounds good dude...thanks for the update @robertjpayne.

from snapkit.

allen-zeng avatar allen-zeng commented on May 3, 2024

Thank you @robertjpayne @cnoon for your help.

Does this mean that ConstraintMaker isn't cleaning up properly? Because internal funcs remakeConstraints and updateConstraints use uninstall.

Are there things we can do (workarounds) to clean up?

from snapkit.

robertjpayne avatar robertjpayne commented on May 3, 2024

ConstraintMaker has extra code to properly clean up so those are just fine!

On 12/01/2015, at 11:12 am, Allen Zeng [email protected] wrote:

Thank you @robertjpayne @cnoon for your help.

Does this mean that ConstraintMaker isn't cleaning up properly? Because internal funcs remakeConstraints and updateConstraints use uninstall.

Are there things we can do (workarounds) to clean up?


Reply to this email directly or view it on GitHub.

from snapkit.

allen-zeng avatar allen-zeng commented on May 3, 2024

Phew! Thanks for clearing that up!

from snapkit.

robertjpayne avatar robertjpayne commented on May 3, 2024

@allen-zeng @cnoon this is fixed up now on master, I'm not pushing to pods trunk yet as I need to do some more testing tonight, I'm not 100% happy with how I implemented it but it works for now as far as I can tell.

from snapkit.

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.