This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
import UIKit | |
struct DocumentPicker: UIViewControllerRepresentable { | |
@Binding var filePath: URL? | |
func makeCoordinator() -> DocumentPicker.Coordinator { | |
return DocumentPicker.Coordinator(parent1: self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Part statement": { | |
"prefix": "pts", | |
"body": [ | |
"part '${TM_FILENAME_BASE}.g.dart';", | |
], | |
"description": "Creates a filled-in part statement" | |
}, | |
"Part 'Freezed' statement": { | |
"prefix": "ptf", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Since the WKWebView has no sizeToFit() method, increase the frame height of the webView to | |
// match the height of the content's scrollHeight | |
// | |
// The WKWebView's `navigationDelegate` property needs to be set for the delegate method to be called | |
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
if webView.isLoading == false { | |
webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [weak self] (result, error) in | |
if let height = result as? CGFloat { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Usage | |
lbl.attributedText = htmlToAttributedString ("html text") | |
//Assign attributed string | |
func htmlToAttributedString(string : String) -> NSAttributedString{ | |
var attribStr = NSMutableAttributedString() | |
do {//, allowLossyConversion: true | |
attribStr = try NSMutableAttributedString(data: string.dataUsingEncoding(NSUnicodeStringEncoding)!, options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for family in UIFont.familyNames() { | |
let sName: String = family as String | |
println("family: \(sName)") | |
for name in UIFont.fontNamesForFamilyName(sName) { | |
println("name: \(name as String)") | |
} | |
} |
Key/Command | Description |
---|---|
Tab | Auto-complete files and folder names |
Ctrl + A | Go to the beginning of the line you are currently typing on |
Ctrl + E | Go to the end of the line you are currently typing on |
Ctrl + U | Clear the line before the cursor |
Ctrl + K | Clear the line after the cursor |
Ctrl + W | Delete the word before the cursor |
Ctrl + T | Swap the last two characters before the cursor |