├── README.md ├── add-subview-layout-anchors.codesnippet ├── add-to-container.codesnippet ├── aspect-ratio-constraint.codesnippet ├── bottom-anchor.codesnippet ├── centerx.codesnippet ├── centery.codesnippet ├── codeblocks.codesnippet ├── color.codesnippet ├── container-view.codesnippet ├── equal-width.codesnippet ├── horizontal-constraint.codesnippet ├── ibaction.codesnippet ├── iboutlet.codesnippet ├── leading-anchor.codesnippet ├── temp-view.codesnippet ├── templabel.codesnippet ├── top-anchor.codesnippet ├── trailing-anchor.codesnippet └── vertical-constraint.codesnippet /README.md: -------------------------------------------------------------------------------- 1 | # xcode-snippets 2 | Handy code snippets used in day to day programming and fast prototyping. 3 | 4 | ## Adding Snippets in Xcode: 5 | You can clone the complete project in ```~/Library/Developer/Xcode/UserData/``` 6 | 7 | OR 8 | 9 | Clone/Download the project on your machine and paste the .codesnippets file in ```~/Library/Developer/Xcode/UserData/CodeSnippets/``` 10 | 11 | ## Examples 12 | * **Temporary Label** 13 | 14 | Adds a temporary label at the center of the viewcontroller's view. 15 | 16 | Shortcut: `templabel` 17 | 18 | Context: Code Expression 19 | 20 | Code: 21 | ```swift 22 | let label = UILabel() 23 | label.translatesAutoresizingMaskIntoConstraints = false 24 | label.text = String(describing: "text") 25 | self.view.addSubview(label) 26 | self.view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: self.view, attribute: .centerX, multiplier: 1.0, constant: 0.0)) 27 | self.view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: self.view, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 28 | ``` 29 | 30 | * **IBOutlet** 31 | 32 | Shortcut: `iboutletsnippet` 33 | 34 | Context: Class Implementation 35 | 36 | Code: 37 | ```swift 38 | @IBOutlet var titleLabel: UILabel! 39 | ``` 40 | 41 | * **IBAction** 42 | 43 | Shortcut: `ibaction` 44 | 45 | Context: Class Implementation 46 | 47 | Code: 48 | ```swift 49 | @IBAction func cancel(_ sender: AnyObject) { 50 | // function body 51 | } 52 | ``` 53 | 54 | * **Vertical Constraint** 55 | 56 | Shortcut: `vertical-constraint` 57 | 58 | Context: Code Expression 59 | 60 | Code: 61 | ```swift 62 | NSLayoutConstraint.constraints(withVisualFormat:"V:|[view]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["view": view]) 63 | ``` 64 | 65 | * **Horizontal Constraint** 66 | 67 | Shortcut: `horizontal-constraint` 68 | 69 | Context: Code Expression 70 | 71 | Code: 72 | ```swift 73 | NSLayoutConstraint.constraints(withVisualFormat:"H:|[view]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["view": view]) 74 | ``` 75 | 76 | * **Color** 77 | 78 | Shortcut: `color` 79 | 80 | Context: Code Expression 81 | 82 | Code: 83 | ```swift 84 | UIColor(red: float/256.0, green: float/256.0, blue: float/256.0, alpha: 1.0) 85 | ``` 86 | 87 | * **Code Blocks** 88 | 89 | Shortcut: `codeblocks` 90 | 91 | Context: Class Implementation 92 | 93 | Code: 94 | ```swift 95 | //MARK: - Override Functions 96 | 97 | //MARK: - IBActions 98 | 99 | //MARK: - Other Functions 100 | ``` 101 | 102 | * **Center-X Constraint** 103 | 104 | Shortcut: `centerx` 105 | 106 | Context: Code Expression 107 | 108 | Code: 109 | ```swift 110 | NSLayoutConstraint(item: view, attribute: .centerX, relatedBy: .equal, toItem: related_view, attribute: .centerX, multiplier: 1.0, constant: 0.0) 111 | ``` 112 | 113 | * **Center-Y Constraint** 114 | 115 | Shortcut: `centery` 116 | 117 | Context: Code Expression 118 | 119 | Code: 120 | ```swift 121 | NSLayoutConstraint(item: view, attribute: .centerY, relatedBy: .equal, toItem: related_view, attribute: .centerY, multiplier: 1.0, constant: 0.0) 122 | ``` 123 | 124 | * **Equal Width Constraint** 125 | 126 | Shortcut: `equal-width` 127 | 128 | Context: Code Expression 129 | 130 | Code: 131 | ```swift 132 | NSLayoutConstraint(item: AnyObject, attribute: .width, relatedBy: .equal, toItem: AnyObject?, attribute: .width, multiplier: 1.0, constant: 0.0) 133 | ``` 134 | 135 | ## Authors 136 | 137 | * **Hassan Ahmed Khan** - [iHAK](https://github.com/ihak) 138 | 139 | -------------------------------------------------------------------------------- /add-subview-layout-anchors.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | addwithlayoutanchors 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | <#view#>.topAnchor.constraint(equalTo: <#superview#>.topAnchor).isActive = true 13 | <#view#>.bottomAnchor.constraint(equalTo: <#superview#>.bottomAnchor).isActive = true 14 | <#view#>.leadingAnchor.constraint(equalTo: <#superview#>.leadingAnchor).isActive = true 15 | <#view#>.trailingAnchor.constraint(equalTo: <#superview#>.trailingAnchor).isActive = true 16 | IDECodeSnippetIdentifier 17 | 498A2661-610B-4DBD-9C85-91EADE7351A4 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Generic 20 | IDECodeSnippetPlatformFamily 21 | iphoneos 22 | IDECodeSnippetSummary 23 | Add top, bottom, leading and trailing anchors of a view to its superview. 24 | IDECodeSnippetTitle 25 | Add subview - layout anchors 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /add-to-container.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | add-to-container 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | <#view#>.translatesAutoresizingMaskIntoConstraints = false 13 | <#super view#>.addSubview(<#T##view: UIView##UIView#>) 14 | <#super view#>.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options: [], metrics: nil, views: ["view": <#view#>])) 15 | <#super view#>.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[view]|", options: [], metrics: nil, views: ["view": <#view#>])) 16 | IDECodeSnippetIdentifier 17 | 658E739C-F8CB-4A63-B8C4-C734AA2DE85E 18 | IDECodeSnippetLanguage 19 | Xcode.SourceCodeLanguage.Swift 20 | IDECodeSnippetSummary 21 | Adds a view to the super view with visual formatting constriants. 22 | IDECodeSnippetTitle 23 | Add subview - visual format 24 | IDECodeSnippetUserSnippet 25 | 26 | IDECodeSnippetVersion 27 | 2 28 | 29 | 30 | -------------------------------------------------------------------------------- /aspect-ratio-constraint.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | aspect-ratio-constraint 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | <#view#>.addConstraint(NSLayoutConstraint.init(item: <#view#>, attribute: .width, relatedBy: .equal, toItem: <#view#>, attribute: .height, multiplier: <#ratio#>, constant: 0.0)) 13 | IDECodeSnippetIdentifier 14 | 91D3EA01-AA4F-4B74-A49E-EC63F19BBD69 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | Adds aspect ratio constraint to the view. 19 | IDECodeSnippetTitle 20 | Aspect Ratio Constraint 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /bottom-anchor.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | bottomanchor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | <#view#>.bottomAnchor.constraint(equalTo: <#superview#>.bottomAnchor).isActive = true 13 | IDECodeSnippetIdentifier 14 | C0E624F1-5D77-4115-AF48-8DA6CE68BE02 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Generic 17 | IDECodeSnippetPlatformFamily 18 | iphoneos 19 | IDECodeSnippetSummary 20 | Adds bottom anchor 21 | IDECodeSnippetTitle 22 | Bottom Anchor 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /centerx.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | centerx 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | NSLayoutConstraint(item: <#view#>, attribute: .centerX, relatedBy: .equal, toItem: <#related view#>, attribute: .centerX, multiplier: 1.0, constant: 0.0) 13 | IDECodeSnippetIdentifier 14 | 947497BC-ADA4-4B8D-AA5C-91CF4986FEAA 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | CenterX constraint snippet 19 | IDECodeSnippetTitle 20 | CenterX Constraint 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /centery.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | centery 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | NSLayoutConstraint(item: <#view#>, attribute: .centerY, relatedBy: .equal, toItem: <#related view#>, attribute: .centerY, multiplier: 1.0, constant: 0.0) 13 | IDECodeSnippetIdentifier 14 | 9F540821-6CEA-48C1-81EB-FC850C384590 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | CenterY constraint snippet 19 | IDECodeSnippetTitle 20 | CenterY Constraint 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /codeblocks.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | codeblocks 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | //MARK: - Override Functions 13 | 14 | //MARK: - IBActions 15 | 16 | //MARK: - Other Functions 17 | 18 | IDECodeSnippetIdentifier 19 | CB54F3EF-0361-49B6-BF1B-C9601D55BE5E 20 | IDECodeSnippetLanguage 21 | Xcode.SourceCodeLanguage.Swift 22 | IDECodeSnippetSummary 23 | Code blocks 24 | IDECodeSnippetTitle 25 | Code Blocks 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /color.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | color 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | UIColor(red: <#T##CGFloat#>/256.0, green: <#T##CGFloat#>/256.0, blue: <#T##CGFloat#>/256.0, alpha: 1.0) 13 | IDECodeSnippetIdentifier 14 | B45D2C19-4FD1-45F5-A990-223C4364ABE7 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | Custom color. 19 | IDECodeSnippetTitle 20 | Color 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /container-view.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | container-view 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | let containerView = UIView() 13 | containerView.backgroundColor = UIColor.blue 14 | containerView.translatesAutoresizingMaskIntoConstraints = false 15 | <#superview#>.addSubview(containerView) 16 | <#superview#>.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|[view]|", options: [], metrics: nil, views: ["view": containerView])) 17 | <#superview#>.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|[view]|", options: [], metrics: nil, views: ["view": containerView])) 18 | 19 | IDECodeSnippetIdentifier 20 | DB6CCFC7-3929-46E0-A715-64660BA44B9C 21 | IDECodeSnippetLanguage 22 | Xcode.SourceCodeLanguage.Swift 23 | IDECodeSnippetSummary 24 | Adds an empty container view to a view. 25 | IDECodeSnippetTitle 26 | Add container view 27 | IDECodeSnippetUserSnippet 28 | 29 | IDECodeSnippetVersion 30 | 2 31 | 32 | 33 | -------------------------------------------------------------------------------- /equal-width.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | equal-width 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | NSLayoutConstraint(item: <#T##AnyObject#>, attribute: .width, relatedBy: .equal, toItem: <#T##AnyObject?#>, attribute: .width, multiplier: 1.0, constant: 0.0) 13 | IDECodeSnippetIdentifier 14 | CA823481-0099-4247-A4B8-626E48C1EF3D 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | Adds equal width constraint between two view. 19 | IDECodeSnippetTitle 20 | Equal Width Constaint 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /horizontal-constraint.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | horizontal-constraint 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | NSLayoutConstraint.constraints(withVisualFormat:"H:|[view]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["view": <#view#>]) 13 | IDECodeSnippetIdentifier 14 | CA276E3D-304D-4C72-B17A-4ECB90EF956A 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | Adds horizontal constaint to the container. 19 | IDECodeSnippetTitle 20 | Horizontal Constraint 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /ibaction.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | ibaction 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | @IBAction func <#name#>(sender: <#Any#>) { 13 | <#function body#> 14 | } 15 | IDECodeSnippetIdentifier 16 | 3C573305-B811-4430-97AD-151136F3A66C 17 | IDECodeSnippetLanguage 18 | Xcode.SourceCodeLanguage.Swift 19 | IDECodeSnippetSummary 20 | IBAction method snippet 21 | IDECodeSnippetTitle 22 | IBAction snippet 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /iboutlet.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | iboutletsnippet 7 | IDECodeSnippetCompletionScopes 8 | 9 | ClassImplementation 10 | 11 | IDECodeSnippetContents 12 | @IBOutlet weak var <#name#>: <#type#>! 13 | IDECodeSnippetIdentifier 14 | E1CFFF13-31CD-4E35-8934-ADA1771CD9AC 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | IBOutlet snippet 19 | IDECodeSnippetTitle 20 | IBOutlet Snippet 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | -------------------------------------------------------------------------------- /leading-anchor.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | leadinganchor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | <#view#>.leadingAnchor.constraint(equalTo: <#superview#>.leadingAnchor).isActive = true 13 | IDECodeSnippetIdentifier 14 | 6173CFF9-A12C-4C49-AEAB-D9134BD0535F 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetPlatformFamily 18 | iphoneos 19 | IDECodeSnippetSummary 20 | Adds leading anchor 21 | IDECodeSnippetTitle 22 | Leading Anchor 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /temp-view.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | temp-view 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | let view = UIView() 13 | view.backgroundColor = UIColor.blue 14 | view.translatesAutoresizingMaskIntoConstraints = false 15 | <#superview#>.addSubview(view) 16 | view.addConstraint(NSLayoutConstraint(item: view, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 100.0)) 17 | view.addConstraint(NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.0, constant: 100.0)) 18 | <#superview#>.addConstraint(NSLayoutConstraint(item: <#superview#>, attribute: .centerX, relatedBy: .equal, toItem: view, attribute: .centerX, multiplier: 1.0, constant: 0.0)) 19 | <#superview#>.addConstraint(NSLayoutConstraint(item: <#superview#>, attribute: .centerY, relatedBy: .equal, toItem: view, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 20 | 21 | IDECodeSnippetIdentifier 22 | D8A39156-A281-4EFF-A4CE-C1F8DB225E33 23 | IDECodeSnippetLanguage 24 | Xcode.SourceCodeLanguage.Swift 25 | IDECodeSnippetSummary 26 | Adds a temporary view to the given view. 27 | IDECodeSnippetTitle 28 | Temporary view 29 | IDECodeSnippetUserSnippet 30 | 31 | IDECodeSnippetVersion 32 | 2 33 | 34 | 35 | -------------------------------------------------------------------------------- /templabel.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | templabel 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | let label = UILabel() 13 | label.translatesAutoresizingMaskIntoConstraints = false 14 | label.text = String(describing: <#text#>) 15 | self.view.addSubview(label) 16 | self.view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerX, relatedBy: .equal, toItem: self.view, attribute: .centerX, multiplier: 1.0, constant: 0.0)) 17 | self.view.addConstraint(NSLayoutConstraint(item: label, attribute: .centerY, relatedBy: .equal, toItem: self.view, attribute: .centerY, multiplier: 1.0, constant: 0.0)) 18 | IDECodeSnippetIdentifier 19 | 93EDE344-D0FD-4A2F-A7F1-49AB0DD665F9 20 | IDECodeSnippetLanguage 21 | Xcode.SourceCodeLanguage.Swift 22 | IDECodeSnippetSummary 23 | Adds temporary label to current view 24 | IDECodeSnippetTitle 25 | Temp Label 26 | IDECodeSnippetUserSnippet 27 | 28 | IDECodeSnippetVersion 29 | 2 30 | 31 | 32 | -------------------------------------------------------------------------------- /top-anchor.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | topanchor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | <#view#>.topAnchor.constraint(equalTo: <#superview#>.topAnchor).isActive = true 13 | IDECodeSnippetIdentifier 14 | 8DA3B565-D780-49F2-B3D0-9ABF5F25FEC9 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetPlatformFamily 18 | iphoneos 19 | IDECodeSnippetSummary 20 | Adds top anchor with the view 21 | IDECodeSnippetTitle 22 | Top Anchor 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /trailing-anchor.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | trailinganchor 7 | IDECodeSnippetCompletionScopes 8 | 9 | All 10 | 11 | IDECodeSnippetContents 12 | <#view#>.trailingAnchor.constraint(equalTo: <#superview#>.trailingAnchor).isActive = true 13 | IDECodeSnippetIdentifier 14 | 6359AA85-DBE5-4DB7-8461-CC4C8CBD74E9 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetPlatformFamily 18 | iphoneos 19 | IDECodeSnippetSummary 20 | Adds trailing anchor 21 | IDECodeSnippetTitle 22 | Trailing Anchor 23 | IDECodeSnippetUserSnippet 24 | 25 | IDECodeSnippetVersion 26 | 2 27 | 28 | 29 | -------------------------------------------------------------------------------- /vertical-constraint.codesnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDECodeSnippetCompletionPrefix 6 | vertical-constraint 7 | IDECodeSnippetCompletionScopes 8 | 9 | CodeExpression 10 | 11 | IDECodeSnippetContents 12 | NSLayoutConstraint.constraints(withVisualFormat:"V:|[view]|", options: NSLayoutFormatOptions(rawValue: 0), metrics: nil, views: ["view": <#view#>]) 13 | IDECodeSnippetIdentifier 14 | 1AB88F05-A4C1-42A9-88D4-9FCBA6A2AFE7 15 | IDECodeSnippetLanguage 16 | Xcode.SourceCodeLanguage.Swift 17 | IDECodeSnippetSummary 18 | Adds vertical constriant to the container. 19 | IDECodeSnippetTitle 20 | Vertical Constraint 21 | IDECodeSnippetUserSnippet 22 | 23 | IDECodeSnippetVersion 24 | 2 25 | 26 | 27 | --------------------------------------------------------------------------------