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

Update SnapKit Constraint offset

I am using SnapKit and can't find a clean way to update the offset of a constraint. It's a simple loading bar view whose inner view (expiredTime) has to fill the parent (left to right) according to percentage. I create the constraint in the…
jalone
  • 1,953
  • 4
  • 27
  • 46
14
votes
3 answers

how to make UIView with equal width and height with SnapKit in Swift?

I want to make a UIView rectangular with SnapKit in Swift, like this lazy var customView: UIView = { let view = UIView(frame: CGRect()) self.addSubview(view) view.snp.makeConstraints({ (make) in …
Khoren Markosyan
  • 208
  • 1
  • 2
  • 7
10
votes
3 answers

Swift - Difficulty with different sized images in TableViewCell

I am loading a number of remote images with Kingfisher and having significant difficulty getting them to load correctly into a Tableview with cells of dynamic heights. My goal is to have the images always be the full width of the screen and of a…
waffl
  • 5,179
  • 10
  • 73
  • 123
10
votes
5 answers

How to update height Constraints by SnapKit and update cell height?

I have a TableViewCell and two button to switch different constrain. I want to update it's height constrain and cell height. like following pic1 when I click buttonB, the view will change like pic2 Then I click buttonA, the view will back to pic1 I…
JimmyLee
  • 507
  • 2
  • 7
  • 24
9
votes
2 answers

Snapkit: Constrain multiple to margins

I'm using Snapkit to simplify my autolayout code, however one scenario seems to popup very regularly, which i'm wondering if there's a way which involves less code. So let's say that I need to pin the edges of a UIView to it's superview margins, we…
TRG
  • 845
  • 1
  • 9
  • 22
8
votes
1 answer

Warning : Unexpected version number in 'available' attribute for non-specific platform '*'

I have this snippet code : @available(*, deprecated:3.0, message:"Use activate().") public func install() { self.activate() } And since i've upgraded to swift5 and xcode 10.2 i get below warning : Unexpected version number in 'available'…
Mohsen Fard
  • 597
  • 9
  • 22
8
votes
2 answers

Constraint animation with SnapKit

I am trying to implement the animation of 2 views using SnapKit. Here is my Animation view: class MatchAnimation: UIView { let viewBackground: UIView = { let view = UIView() view.backgroundColor = UIColor(red: 0/255, green:…
Florian Ldt
  • 1,125
  • 3
  • 13
  • 31
7
votes
1 answer

Using SnapKit to Aspect Ratio and less size

I am trying to create the constraints of this layout in SnapKit but I have difficulty setting the maximum size (lessThanOrEqual). let maxWidthContainer: CGFloat = 435 let maxHeightContainer: CGFloat = 600 containerView.snp.makeConstraints { …
rafaeldepaula
  • 168
  • 1
  • 1
  • 10
7
votes
2 answers

Using snapkit / autolayout with UIScrollView

I have an app that will have a scrollView contentView chart buttons other stuff I tried constraining it like shown below, but I am missing a constraint and I can't find out what I need. self.view.addSubview(self.scrollView) …
Peter S
  • 827
  • 1
  • 8
  • 24
6
votes
1 answer

How can I lower the view into the safe area?

I'm practicing using snapkit to place ui of view. However, I tried many things to move the red box into the safe area under the notch, but I couldn't find a way. var redView = UIView() override func viewDidLoad() { …
monglong
  • 455
  • 3
  • 11
6
votes
3 answers

Vertical-center UIImageView with snapkit

How can I vertical-center a UIImageView in super view with the snapkit? I tried like this: imageview.snp.makeConstraints { (make) in make.centerY.equalTo(view.center.y); } but seems not well.How can I use the snapkit
Z.Q
  • 103
  • 1
  • 1
  • 8
6
votes
1 answer

Relative positioning using auto layout and SnapKit

I have a label which I want to have the same relative position on the screen, no matter what device is used. E.g. the label is positioned 10% off from the views top margin and 30% off from the views left margin. A constant will always do the…
Jake2Finn
  • 516
  • 5
  • 19
5
votes
2 answers

Swift: How to get correct UICollectionView height when using snapkit?

I'm likely going about this in the completely wrong way since what I try to do should be simple... I have a view component which contains a few subviews, one of them being a UICollectionView. I layout the subviews using SnapKit. The UICollectionView…
jola
  • 977
  • 2
  • 10
  • 31
5
votes
1 answer

Recalculate SnapKit Constraint on orientation change

I want to recalculate the height constraint when the phone orientation changes. I'm using the functions uninstall() and install() to make this happen. However, it's not working as desired. Am I using them incorrectly? class…
mauryat
  • 1,610
  • 5
  • 29
  • 53
4
votes
1 answer

Integrating Snap-kit in android

I am trying to add snap-kit in my application and I have integrated everything as their documentation. App successfully launched Snapchat app but it's not login it shows an error Something is wrong Here is my complete code and other implementation.…
Md. Shofiulla
  • 2,135
  • 1
  • 13
  • 19
1
2 3
15 16