XcodeCodeSnippets alternatives and similar libraries
Based on the "Other Xcode" category.
Alternatively, view XcodeCodeSnippets alternatives based on common mentions on social networks and blogs.
-
Synx
A command-line tool that reorganizes your Xcode project folder to match your Xcode groups. -
SBShortcutMenuSimulator
3D Touch shortcuts in the Simulator -
Swift-VIPER-Module
Xcode template for create modules with VIPER Architecture written in Swift 3 -
Xcode Developer Disk Images
Xcode Developer Disk Images is needed when you want to put your build to the device, however sometimes your Xcode is not updated with the latest Disk Images, you could find them here for convenience. -
swift-project-template
Template for iOS Swift project generation. -
ViperC
Xcode template for VIPER Architecture written in Objective-C -
awesome-xcode-scripts
A curated list of useful xcode scripts ๐. -
Sample Project
A starter project for Sample Project in Objective C. Objective C version of https://github.com/xeieshan/SwiftySampleProject -
VIPER Module Template
Xcode Template of VIPER Module which generates all layers of VIPER. -
awesome-gitignore-templates
A collection of swift, objective-c, android and many more langugages .gitignore templates ๐. -
dsnip
Tool to generate (native) Xcode code snippets from all protocols/delegate methods of UIKit (UITableView, ...) -
Xcode Template Manager
Xcode Template Manager is a Swift command line tool that helps you manage your Xcode project templates. -
Xcode Keymap for Visual Studio Code
This extension ports popular Xcode keyboard shortcuts to Visual Studio Code. -
Microfeatures
Architectural approach to structure your Xcode projects.
Scout APM - Leading-edge performance monitoring starting at $39/month
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of XcodeCodeSnippets or a related project?
README
XcodeCodeSnippets
A set of snippets for Xcode.
Requirements
Xcode 7.3.1 or later.
Installation
To install or update the snippets you need:
- Quit Xcode
- On the command line:
cd ~/Downloads
git clone https://github.com/ismetanin/XcodeCodeSnippets
mkdir -p $HOME/Library/Developer/Xcode/UserData/CodeSnippets
cp XcodeCodeSnippets/CodeSnippets/* $HOME/Library/Developer/Xcode/UserData/CodeSnippets
rm -rf XcodeCodeSnippets
Or if you have a cloned repository:
- On the command line, cd into the directory with snippets and write
sh ./install.sh
List of snippets
MARKs
There are MARKs for Swift and Objective-C. For Swift there is prefix before each // MARK: -
and for Objective-C prefix is #pragma mark -
.
Shortcuts are equal to snippet body for example for // MARK: - Properties
shortcut is Properties
.
Available MARKs
Snippet |
---|
Just empty mark (// MARK: - or #pragma mark - ) |
Nested types |
Constants |
Subviews |
NSLayoutConstraints |
Properties |
Public properties |
Readonly properties |
IBOutlets |
Initialization and deinitialization |
UITableViewCell |
UIViewController |
Actions |
IBActions |
Public methods |
Internal methods |
Private methods |
Code
- A template for creating TableViewAdapter, shortcut:
Table View Adapter
Code
import UIKit
protocol <#Your#>TableViewAdapterOutput {
}
final class <#Your#>TableViewAdapter: NSObject {
// MARK: - Properties
private let output: <#Your#>TableViewAdapterOutput
private var items: [String]
private var tableView: UITableView
// MARK: - Initialization and deinitialization
init(tableView: UITableView, output: <#Your#>TableViewAdapterOutput) {
self.output = output
self.tableView = tableView
self.items = []
super.init()
setupTable()
}
// MARK: - Internal methods
func configure(with items: [String]) {
self.items = items
tableView.reloadData()
}
// MARK: - Private methods
private func setupTable() {
tableView.delegate = self
tableView.dataSource = self
tableView.register(
UINib(nibName: String(describing: <#Your#>TableViewCell.self), bundle: nil),
forCellReuseIdentifier: String(describing: <#Your#>TableViewCell.self)
)
}
}
// MARK: - UITableViewDataSource
extension <#Your#>TableViewAdapter: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return items.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(
withIdentifier: String(describing: <#Your#>TableViewCell.self),
for: indexPath
) as? TableViewCell
cell?.backgroundColor = .red
return cell ?? <#Your#>UITableViewCell()
}
}
// MARK: - UITableViewDelegate
extension <#Your#>TableViewAdapter: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
}
}
- A code block for creating user property in UserDefaults extension, shortcut:
Defaults Key
Code
var <#defaultsKey#>: <#Type#> {
get { return <#typeof#>(forKey: #function) }
set { set(newValue, forKey: #function) }
}
- A code block for layouting child view anchors equal to the parent view anchors, shortcut:
Constraints - layout child as parent
Code
<#childView#>.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
<#childView#>.topAnchor.constraint(equalTo: <#parentView#>.safeAreaLayoutGuide.topAnchor, constant: 0),
<#childView#>.bottomAnchor.constraint(equalTo: <#parentView#>.safeAreaLayoutGuide.bottomAnchor, constant: 0),
<#childView#>.leadingAnchor.constraint(equalTo: <#parentView#>.safeAreaLayoutGuide.leadingAnchor, constant: 0),
<#childView#>.trailingAnchor.constraint(equalTo: <#parentView#>.safeAreaLayoutGuide.trailingAnchor, constant: 0)
])
- A code block for user property creating in NSNotification.Name extension, shortcut:
NSNotification Name
Code
static let <#notificationName#> = NSNotification.Name("<#projectName#>.notifications.<#notificationName#>")
- A code block for creating template comments for unit test, shortcut:
testtemplate
Code
// given
// when
// then
- A code block for creating template constants enum, shortcut:
Constants enum
Code
// MARK: - Nested types
private enum Constants {
}
```
</details>
* A code block for creating keyboard notifications detector, **shortcut:** `Keyboard detector`
<details>
<summary>Code</summary>
<br>
```swift
func addKeyboardObservers() {
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillShow),
name: UIResponder.keyboardWillShowNotification,
object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillHide),
name: UIResponder.keyboardWillHideNotification,
object: nil)
}
@objc
func keyboardWillShow(notification: NSNotification) {
guard
let frame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue
else {
return
}
}
@objc
func keyboardWillHide() {
}
Author
Ivan Smetanin, [email protected]
License
XcodeCodeSnippets is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the XcodeCodeSnippets README section above
are relevant to that project's source code only.