##Adding Swift Build System
- Open Sublime Text 3
- Go To
Preferences > Browse Packages... - Add a file named
Swift.sublime-buildinsidePackagesdirectory. - Copy the following script in
Swift.sublime-buildfile.
{
"shell_cmd": "xcrun swift $file",
| #!/bin/bash | |
| # | |
| # hook script for swiftlint. It will triggered when you make a commit. | |
| # | |
| #TODO: move this content to separate file ('lint'), add separate file for swiftformat ('format'), use them here in pre-commit | |
| GUI=0 | |
| LINT_PATH_FOR_GUI="/usr/local/bin/swiftlint" |
| //: A UIKit based Playground for presenting user interface | |
| import UIKit | |
| import PlaygroundSupport | |
| let container = UIView(frame: CGRect(x: 0, y: 0, width: 500, height: 200)) | |
| container.backgroundColor = .lightGray | |
| class MyView: UIView { |
| extension UIFont { | |
| /** | |
| Will return the best font conforming to the descriptor which will fit in the provided bounds. | |
| */ | |
| static func bestFittingFontSize(for text: String, in bounds: CGRect, fontDescriptor: UIFontDescriptor, additionalAttributes: [NSAttributedStringKey: Any]? = nil) -> CGFloat { | |
| let constrainingDimension = min(bounds.width, bounds.height) | |
| let properBounds = CGRect(origin: .zero, size: bounds.size) | |
| var attributes = additionalAttributes ?? [:] | |
| /// Core Animation doesn't support chaining of animations by default. The `CAAnimationChain` class adds this ability. | |
| /// The `CAAnimationSet` struct holds animation set for one target, and `CAAnimationChain` accepts an array of | |
| /// `CAAnimationSet`s to support multiple targets. | |
| import Foundation | |
| class CAAnimationChain: NSObject, CAAnimationDelegate { | |
| private var animationSets: [CAAnimationSet] | |
| private let completion: (() -> Void)? |
| // Public domain - https://gist.github.com/nolanw/dff7cc5d5570b030d6ba385698348b7c | |
| import Foundation | |
| extension URLRequest { | |
| /** | |
| Configures the URL request for `multipart/form-data`. The request's `httpBody` is set, and a value is set for the HTTP header field `Content-Type`. | |
| - Parameter parameters: The form data to set. |
| import SwiftUI | |
| import WidgetKit | |
| struct WaterAppTimelineProvider: TimelineProvider { | |
| func placeholder(in context: Self.Context) -> WaterAppWidgetEntry { | |
| return .previewData | |
| } | |
| func getSnapshot(in context: Self.Context, completion: @escaping (WaterAppWidgetEntry) -> Void) { |
| #!/bin/bash | |
| # | |
| # Succeed on all merge and rebase messages, as evidenced by MERGE_MSG and SQUASH_MSG existing | |
| [ -f "$GIT_DIR"/MERGE_MSG ] || [ -f "$GIT_DIR"/SQUASH_MSG ] && exit 0 | |
| # Exit if this is an amend operation (ticket number already in message) | |
| [ "$2" = "commit" ] && exit 0 | |
| JIRA_TAG_PATTERN="(mnlth|plans|mf|cust)-[0-9]+" |
| #import <UIKit/UIKit.h> | |
| @interface NumberPadDoneBtn : UIView | |
| @end | |
| @interface NumberPadButton : UIButton | |
| @end |
| // https://noahgilmore.com/blog/nesting-property-wrappers | |
| import Cocoa | |
| protocol Appendable { | |
| func appending(string: String) -> Self | |
| } | |
| extension String: Appendable { | |
| func appending(string: String) -> String { |
##Adding Swift Build System
Preferences > Browse Packages...Swift.sublime-build inside Packages directory.Swift.sublime-build file.{
"shell_cmd": "xcrun swift $file",