Questions tagged [snapkit]

A Swift Autolayout DSL for iOS & macOS. Use if you have questions about the library and not about Snapchat or similar services.

SnapKit is a DSL to make Auto Layout easy on both iOS and macOS.

GitHub Page

239 questions
1
vote
1 answer

Snapkit LayoutConstraints Unable to simultaneously satisfy constraints

I have simple UITableView and custom UITablViewCell in my project, which created programmatically and use SnapKit for auto layout its. When I run app, everything work fine and get some LayoutConstraints error in debug…
1
vote
1 answer

.equalSpacing in UIStackView not working properly with CustomView

I have created a custom view of checkbox / radio button that animates when checked and unchecked. Problem is when I embed the custom view to a stackView that is .equalSpacing the button cannot be tapped anymore, my guess is the borderView(which has…
Dreiohc
  • 317
  • 2
  • 12
1
vote
0 answers

Constraints on view not updating

I'm trying to update the constraints of my view when the keyboard appears and disappears I have notifications for keyboardWillShow and keyboardWillHide and corresponding functions to call them: NotificationCenter.default.addObserver(self,…
user3492121
  • 535
  • 1
  • 4
  • 12
1
vote
2 answers

SnapKit throws an error when you try to give constraints to UIView

I have a UIView that is hooked up to my View Controller as IBOutlet. I assigned an AnimationView class instance to this property in my ViewDidLoad method and set constraints to it with animationView.snp.makeConstraints { (make) in…
Junsu Kim
  • 356
  • 3
  • 13
1
vote
2 answers

Updating variable in view constraint (SnapKit)

View is initialized with following constraints View.snp.makeConstraints { (para) in View.topConstraint = para.top.equalTo(parentview.snp.top).constraint View.LeadingConstraint =…
Divine
  • 118
  • 1
  • 9
1
vote
1 answer

CollectionView cell Snapkit constraints fail when applying offset

I have the follwowing constraints applied to my Cell via SnapKit and they work fine. self.imageView.snp.makeConstraints { make in make.leading.top.trailing.equalToSuperview() make.bottom.equalTo(self.nameLabel.snp.top) if let…
Wazza
  • 1,725
  • 2
  • 17
  • 49
1
vote
2 answers

How to put two labels horizontally by aligning their top edges in iOS?

I want to create custom view like below. As you see, it consists from title and price labels. Title can have million number of lines, but its top edge should be aligned with price label. It seems simple design, but it has hundreds of solution. I…
neo
  • 1,314
  • 2
  • 14
  • 34
1
vote
2 answers

Constraints are broken after pushing VC again

My constraints are broke when I pop VC. I have table view, when I firstly push table view, constraints are work perfectly, but after poping and pushing again they are broke. First image are working good, but in second they are broke Maybe problem is…
1
vote
2 answers

iOS Auto Layout keeps the minimum gap when the space is not enough, and takes up as much space as possible when the space is enough

This is the layout. The top Label text may get very long, and I expect the Label selected at the bottom to be at least 40 pt from the bottom button when there is enough space at the moment, and at least 10 pt when there is not enough space.I tried…
Vincent Sit
  • 2,214
  • 1
  • 24
  • 27
1
vote
1 answer

How to use aspect ratio constraint in iOS using SnapKit?

I trying to create an aspect ratio constraint 1:1 using snapkit. If I would using storyboard, that could simply be achieved using the aspect ratio constraint tool, but with SnapKit, this not appears to be so easy. How can I achieve that?
Ráfagan
  • 2,165
  • 2
  • 15
  • 22
1
vote
1 answer

UILabel not resizing after scaling font using minimumScaleFactor

I have a UILabel inside a UITableViewCell that I want to dynamically adjust its font and size based on content to always maintain the largest font that it can support without truncating. I am most of the way there using adjustsFontSizeToFitWidth,…
Nick Alexander
  • 1,543
  • 1
  • 14
  • 26
1
vote
1 answer

Stacking views programmatically in UIStackView

I have spent a long time trying to stack the views that I create programmatically. I looked at examples from Add views in UIStackView programmatically but that didn't work. Listed below is the code, I am calling the setUpListings from the view…
AlwaysNull
  • 348
  • 2
  • 4
  • 15
1
vote
2 answers

Creating UIViews Programmatically doesn't work in Xcode 11.1

I want to create an UIView as a container view or even more programmatically with the snapkit in Xcode 11.1, but it seems there is something wrong and I think Apple has changed UIView in Xcode 11.x (iOS 13.x) because I did it very easily in the…
Reza Dehnavi
  • 2,256
  • 3
  • 16
  • 30
1
vote
0 answers

How to get entire snapshot of scrollview/tableview(Autolayout/SnapKit)

When I use Frame to layout subviews, I could get entire snapshot of scrollview. But when I use AutoLayout/SnapKit, the code below will not work. Why? extension UIScrollView { var cc_snapshot: UIImage? { …
zzzwco
  • 184
  • 6
1
vote
2 answers

Expand tableview and increase scrollview content size by an appropriate difference on clicking a button inside a table cell

I have a UITableView which has been added inside a UIScrollView as part of a view controller which adheres to a part of the mockup shown below:- As you can see in the mockup, the UITableView is situated in between the label 'Featured Businesses'…
Pavan Vasan
  • 391
  • 1
  • 9
  • 28