Comments (9)
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.
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 anOptional
so you'd have to unwrap it before callinguninstall()
- 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.
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.
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.
Sounds good dude...thanks for the update @robertjpayne.
from snapkit.
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.
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.
Phew! Thanks for clearing that up!
from snapkit.
@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)
- J
- The use of SnapKit in a framework is causing a crash HOT 3
- can not call the deinit method
- Apple Vision Pro: No such module 'AppKit' HOT 3
- XCode 15 build SnapKit error HOT 1
- Snapkit
- Try to commit
- Would it be possible to have a new release? HOT 3
- privacy manifest HOT 18
- Why removeConstraints wouldn't call translatesAutoresizingMaskIntoConstraints = true
- How to use SnapKit achieve the following requirements? view.width = (superView.width - 30) * 0.3 HOT 3
- Wtf HOT 2
- Is Snapkit dead?
- Error HOT 1
- Broken github issue template
- Can't download the latest (5.7.0) version with cocoapods HOT 7
- My project supports iOS11 HOT 4
- SnapKit SDK Signature HOT 1
- My phones glitched
- Swift Package Manager - support for all suite
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snapkit.