This file contains hidden or 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 UIKit | |
class SecondViewController: UIViewController { | |
// reference the new text field | |
@IBOutlet weak var DisplayField: UITextField! | |
// create variable for new text field to display | |
var userText:String! = "" |
This file contains hidden or 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 UIKit | |
import MapKit | |
import CoreLocation | |
class ViewController: UIViewController, UITextFieldDelegate, CLLocationManagerDelegate, MKMapViewDelegate { | |
// reference the user input field | |
@IBOutlet weak var inputText: UITextField! | |
override func viewDidLoad() { |
This file contains hidden or 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
function rgbToHex(r, g, b) { | |
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); | |
} | |
function colorFromString(value) { | |
var immutable = MSImmutableColor.colorWithSVGString_(value); | |
return MSColor.alloc().initWithImmutableObject_(immutable); | |
} |
This file contains hidden or 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
function updateAllExistingStyles(doc, styleID, sharedStyles, index){ | |
//reference the pages array in the document | |
var pages = doc.sketchObject.pages(); | |
for (var i = 0; i < pages.count(); i++){ | |
//reference each page | |
var page = pages[i]; | |
//reference the artboards array of each page | |
var artboards = [page artboards]; |
This file contains hidden or 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 (var k = 0; k < sharedStyles.numberOfSharedStyles(); k++){ | |
var layerStyle = sharedStyles.objects().objectAtIndex(k); | |
var styleName = String(layerStyle.name()); | |
//checks if the name of the imported color is the same as the existing | |
if(styleName == colorName){ | |
var fill = layerStyle.value().fills().firstObject(); | |
var oldFill = String("#" + fill.color().immutableModelObject().hexValue()); |
This file contains hidden or 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
function checkIfExists(colorName, existingStyles){ | |
var existsArray = []; | |
for (var i = 0; i < existingStyles.length; i++){ | |
if(existingStyles[i] == colorName){ | |
existsArray.push(colorName); | |
} | |
} | |
if(existsArray.length > 0){ | |
return true; |
This file contains hidden or 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(var i = 0; i < palette.length; i++){ | |
for(var z = 0; z < palette[i].length; z++){ | |
//get the values we need from the palette array | |
var colorName = palette[i][z].name; | |
var colorValue = palette[i][z].value; | |
} | |
} |
This file contains hidden or 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
var sketch = context.api(); | |
var doc = sketch.selectedDocument; | |
var sharedStyles = doc.sketchObject.documentData().layerStyles(); | |
var numberOfSharedStyles = Number(sharedStyles.numberOfSharedStyles()); | |
//create array to hold existing styles for reference later | |
var existingStyles = []; | |
//if there are exisitng styles push them to array |
NewerOlder