If you have to extend an existing object with additional property, always prefer Vue.set()
over Object.assign()
(or spread operator).
Example below explains implications for different implementations.
let excludedActivityTypes = [ | |
UIActivity.ActivityType.print, | |
UIActivity.ActivityType.openInIBooks, | |
UIActivity.ActivityType.copyToPasteboard, | |
UIActivity.ActivityType.addToReadingList, | |
UIActivity.ActivityType.assignToContact, | |
UIActivity.ActivityType.copyToPasteboard, | |
UIActivity.ActivityType.mail, | |
UIActivity.ActivityType.markupAsPDF, | |
UIActivity.ActivityType.postToFacebook, |
// | |
// AGUploadImageWebServices.swift | |
// BaseProject | |
// | |
// Created by AshvinGudaliya on 27/02/18. | |
// Copyright © 2018 AshvinGudaliya. All rights reserved. | |
// | |
import UIKit |
let a: Double? = 1.0 | |
let b: Double? = 2.0 | |
let c: Double? = 3.0 | |
let d: Double? = 4.0 | |
let e: Double? = 5.0 | |
let f: Double? = 6.0 | |
let g: Double? = 7.0 | |
extension Optional { | |
func `or`(_ value : Wrapped?) -> Optional { |
import Foundation | |
import WebKit | |
// See https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/AdoptingCocoaDesignPatterns.html for more details. | |
private var observerContext = 0 | |
class StackableWebView: WKWebView { | |
// Keep track of height which will change when the view is loaded. | |
var webViewHeight: CGFloat = 0.0 |
Reasons to create UIs in code rather than Storyboards: | |
Merge conflicts | |
Easier to diff revisions and see changes in code | |
More flexibility to move UI elements on iPad vs iPhone, | |
portrait vs landscape | |
Easier theme support |
// check version | |
node -v || node --version | |
// list locally installed versions of node | |
nvm ls | |
// list remove available versions of node | |
nvm ls-remote | |
// install specific version of node |
import WebKit | |
class NativeWebViewController: UIViewController { | |
let viewportScriptString = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); meta.setAttribute('initial-scale', '1.0'); meta.setAttribute('maximum-scale', '1.0'); meta.setAttribute('minimum-scale', '1.0'); meta.setAttribute('user-scalable', 'no'); document.getElementsByTagName('head')[0].appendChild(meta);" | |
let disableSelectionScriptString = "document.documentElement.style.webkitUserSelect='none';" | |
let disableCalloutScriptString = "document.documentElement.style.webkitTouchCallout='none';" | |
override func viewDidLoad() { | |
// 1 - Make user scripts for injection |
//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) | |
I use the first | |
—– BEGIN LICENSE —– | |
Michael Barnes | |
Single User License | |
EA7E-821385 | |
8A353C41 872A0D5C DF9B2950 AFF6F667 | |
C458EA6D 8EA3C286 98D1D650 131A97AB | |
AA919AEC EF20E143 B361B1E7 4C8B7F04 |