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
0
votes
1 answer

AutoLayout constraints to fit view inside rectangle, preserving a certain aspect ratio (programmatically)

I want to fit an image inside a rectangle that should have a specific aspect ratio. No matter what it is, it should find a form to fit inside the rectangle. I played around in storyboard and got this: The ones with the dotted border have low…
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63
0
votes
1 answer

Dive into implementation of updateConstraints() method

There's one question: should I call setNeedsLayout() & layoutIfNeeded() after calling .snp.updateConstraints() method? Or the implementation of updateConstraints() by default makes it? Thanks in advance!
Dave
  • 5
  • 2
0
votes
1 answer

Snapkit Layout issue - UITextView going beyond UIView

Using snapkit, I got the image below. The text view is going over the pop up view and the "List Name" pop up title is more than 10px above the text view. How to fix? Code private func makePopUpTitle() { popUpTitle.text = "List Name" …
Alex
  • 2,369
  • 3
  • 13
  • 23
0
votes
1 answer

The right way to write masonry code? in “- init” or “- layoutSubViews”

Both ways seem to work, are there any differences in performance?
Leo.J
  • 317
  • 1
  • 3
  • 10
0
votes
1 answer

Updating bottom constraint with SnapKit and Swift 4

Here is my code. I am using KeyboardHelper library for managing keyboard states and getting keyboard height, and also SnapKit. I have a text field that triggers keyboard. When a keyboard is visible I want to raise blue box above keyboard bounds, so…
Kira
  • 1,575
  • 4
  • 26
  • 48
0
votes
1 answer

use SnapKit make constraint to a UIView but show nothing

At a full clear new swift project from "Single View App" template. When I ensure SnapKit can be import correctly. I just play very simple code to show a Rectangle: let test = UIView() test.backgroundColor = UIColor.green test.frame.size…
Wibrst X
  • 1
  • 4
0
votes
1 answer

Error adding UIActivityIndicatorView in UITableViewController using constraints. Unable to activate constraint with anchors using SnapKit

I am getting this error in my application when i set the constraints of an UIActivityIndicatorView there is inside of an UITableViewController.The error ocurrs when i call the showFooter function: Fatal Exception: NSGenericException Unable to…
0
votes
1 answer

how to add a constrains to fix tableview to its parent bottom

i have a container in my view with two tableview controllers as childs. i have the childs as this properties in class lazy var photoFeedVC: UserPicsTableViewController = self.makeAndAddVC() lazy var postFeedVC: PostFeedVC =…
user4812550
0
votes
1 answer

UITableViewAutomaticDimension To fit subviews

My app has a table view with automatic sized row heights (UITableViewAutomaticDimension for heightForRow-Delegate-Function). My custom cells have subviews, that can have different sizes (they contain an always different number of bar…
Pascal
  • 2,590
  • 3
  • 21
  • 46
0
votes
1 answer

Autolayout with SnapKit not responding as expected

Just trying to add a UILabel using SnapKit autolayout. The code i'm using is as follows: override func viewDidLoad() { super.viewDidLoad() self.view.backgroundColor = .lightGray let userNameLabel = UILabel() userNameLabel.text =…
Dinesh Nagarajan
  • 1,063
  • 2
  • 10
  • 22
0
votes
0 answers

Swift: Rotate UIImageView from fixed position to full screen

I want to rotate a view. Tried different things but can not make it I use autolayout. As a result I have imageView in the top of the screen with share almost as a square func presentPortrait() { coverImageView.layer.transform =…
dsfs
  • 189
  • 1
  • 3
  • 10
0
votes
1 answer

Auto-Layout [Snapkit] change constraints on rotate

I have built an app that uses no interface builder using Snapkit to create my Auto-Layout constraints. Everything looks fine in portrait, however a few screen's need some landscape specific constraints. I've searched here and Google in general for a…
TRG
  • 845
  • 1
  • 9
  • 22
0
votes
1 answer

How to position right element with offset based on left element

It is simple. I want to make this using SnapKit: leftElement rightElement anotherleftElement rightElement lftElmnt rightElement It means that every rightElement have margin based on width of leftElement plus lets say 20 px. I use it as a cell…
Boomerange
  • 616
  • 1
  • 10
  • 18
0
votes
2 answers

How to make a constraint use the view with highest height from an array of views

Let's assume I have 4 views, 3 in a row and 1 in another row. The ones at the first row have dynamic height and we have no idea how tall they are. I want to achieve the result from this image: Basically I want to set View 4's top to bottom of…
The Cook
  • 1,403
  • 3
  • 17
  • 33
0
votes
1 answer

Koloda - Animate shuffle effect on load

I am using Koloda to present a deck of playing cards that can be swiped through. I have this part working well. When I initially load this deck of cards I would like each view / card to fly in separately and then show as being stacked. I would call…