<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kevin Gutowski on Medium]]></title>
        <description><![CDATA[Stories by Kevin Gutowski on Medium]]></description>
        <link>https://medium.com/@kevingutowski?source=rss-212bdd50c4a8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*klMKFnQsXeCa5MgPkpJfAA.jpeg</url>
            <title>Stories by Kevin Gutowski on Medium</title>
            <link>https://medium.com/@kevingutowski?source=rss-212bdd50c4a8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:48:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kevingutowski/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to setup a TableView in 2019 (Obj-C)]]></title>
            <link>https://medium.com/@kevingutowski/how-to-setup-a-tableview-in-2019-obj-c-c7dece203333?source=rss-212bdd50c4a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7dece203333</guid>
            <category><![CDATA[tableviews]]></category>
            <category><![CDATA[cocoa]]></category>
            <category><![CDATA[objective-c]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[nstableview]]></category>
            <dc:creator><![CDATA[Kevin Gutowski]]></dc:creator>
            <pubDate>Tue, 13 Aug 2019 06:14:55 GMT</pubDate>
            <atom:updated>2019-08-13T06:39:50.406Z</atom:updated>
            <content:encoded><![CDATA[<p>I was trying to follow some old Cocoa tutorials (<a href="https://www.youtube.com/watch?v=_Qbjwx0hB6A">here</a> and <a href="https://www.youtube.com/watch?v=lQqOl12lmBE">there</a>) and kept on getting stuck whenever NSTableViews were covered. I’d implement all the same functions and would get really close. But when it came to rendering the data, it would always display default text:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ufui9eZg74gO3deB2273aA.png" /><figcaption>So close yet so far. Womp, womp…</figcaption></figure><p>I asked some friends for some help and they pointed me in the right direction — <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TableView/PopulatingView-TablesProgrammatically/PopulatingView-TablesProgrammatically.html">the apple docs on table views</a>. So after a little tinkering here is the basic setup for table views in objective-c. Lots of pictures below!</p><p>Start by creating a new macOS Cocoa App project in Xcode. Make sure the language is set to <strong>Objective-C</strong> of course.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_giz0KsT8nZw1Y3SnzKDdg.png" /></figure><p>Once all setup, in your Main.storyboard, drag in a tableview to your view controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7UaydsU-HI1waGfZiFhuNQ.png" /></figure><p>Don’t really need to bother with constraints for this but you are welcome to fiddle with that if you like.</p><p>Next, set the column identifiers. In this example I use numbers and letters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZEJFxssJ_btUw3MzxD4BAA.png" /></figure><p>Now, create the custom TableViewController class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ydM5NpSlO1vptqfFBjWH2g.png" /></figure><p>In the header file we will want to import the Cocoa framework and conform to both NSTableViewDataSource and NSTableViewDelegate .</p><pre>#import &lt;Foundation/Foundation.h&gt;<br>#import &lt;Cocoa/Cocoa.h&gt;</pre><pre>NS_ASSUME_NONNULL_BEGIN</pre><pre>@interface TableViewController : NSObject &lt;NSTableViewDataSource, NSTableViewDelegate&gt;</pre><pre>@end</pre><pre>NS_ASSUME_NONNULL_END</pre><p>We will also have two arrays. One for our numbers and one for our letters.</p><pre>#import &lt;Foundation/Foundation.h&gt;<br>#import &lt;Cocoa/Cocoa.h&gt;</pre><pre>NS_ASSUME_NONNULL_BEGIN</pre><pre>@interface TableViewController : NSObject &lt;NSTableViewDataSource, NSTableViewDelegate&gt;</pre><pre>@property (nonatomic, strong) NSArray *numbers;<br>@property (nonatomic, strong) NSArray *letters;</pre><pre>@end</pre><pre>NS_ASSUME_NONNULL_END</pre><p>Let’s flip over to the implementation file and setup our array initializers.</p><pre>#import &quot;TableViewController.h&quot;</pre><pre>@implementation TableViewController</pre><pre>- (NSArray *)numbers {<br>    if (!_numbers) {<br>        _numbers = @[@&quot;1&quot;, @&quot;2&quot;, @&quot;3&quot;, @&quot;4&quot;, @&quot;5&quot;, @&quot;6&quot;, @&quot;7&quot;, @&quot;8&quot;, @&quot;9&quot;, @&quot;10&quot;];<br>    }<br>    return _numbers;<br>}</pre><pre>- (NSArray *)letters {<br>    if (!_letters) {<br>        _letters = @[@&quot;a&quot;, @&quot;b&quot;, @&quot;c&quot;, @&quot;d&quot;, @&quot;e&quot;, @&quot;f&quot;, @&quot;g&quot;, @&quot;h&quot;, @&quot;i&quot;, @&quot;j&quot;];<br>    }<br>    return _letters;<br>}</pre><pre>@end</pre><p>We will also need to implement two key protocol methods. One for the data source and one for the delegate.</p><pre>// NSTableViewDataSource</pre><pre>- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {<br>    return self.numbers.count;<br>}</pre><p>And the other one:</p><pre>// NSTableViewDelegate</pre><pre>-(NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {</pre><pre>    NSString *identifier = tableColumn.identifier;<br>    NSTableCellView *cell = [tableView makeViewWithIdentifier:identifier owner:self];</pre><pre>    if ([identifier isEqualToString:@&quot;numbers&quot;]) {<br>        cell.textField.stringValue = [self.numbers objectAtIndex:row];<br>    } else {<br>        cell.textField.stringValue = [self.letters objectAtIndex:row];<br>    }</pre><pre>    return cell;<br>}</pre><p>Well… objective-c doesn’t make for the easiest code to fit here. Anywho, this protocol method first gets the tableColumn’s identifier. We then use that identifier to make a TableCellView. Lastly, we check the identifier and switch the string data depending whether its the numbers or letters column.</p><p>Note that we aren’t implemeting:</p><pre>- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row</pre><p>or</p><pre>-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row</pre><p>I couldn’t get either of these to work.</p><p>Last step is to hook the NSTableView up to the custom class. Drag and drop an NSObject onto the View Controller Scene. Then change the class to TableViewController</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BtV6qimEqT6xsLPVGkRxqw.png" /></figure><p>Once that is set then right click on the table view layer. Drag the dataSource and the delegate outlets over to the Table View Controller object that we just added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eowfiO3sjs6TdgH85n0yEw.png" /></figure><p>Now that everything is wired up, give the app a spin and see how it looks!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xJtYJEnf9pHe-UlaVf4M3Q.png" /><figcaption>Oh how marvelous! Isn’t it just beautiful?? 😍</figcaption></figure><p>Here is a <a href="https://github.com/KevinGutowski/TableDemo/tree/master">link to the sample code</a>.</p><p>I’ll be posting more of these little cocoa tutorials. My main goal is to bring it back around to incorporating these interfaces with Sketch. If you are wanting to learn more about Sketch plugins then check out <a href="https://medium.com/@kevingutowski/how-to-build-your-first-sketch-plugin-14c0e9e56bf0">my previous article</a> on it! Also, thanks to Matt and Aby for helping me figure out objective-c cocoa programming in 2019.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7dece203333" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your first steps to creating Sketch plugins]]></title>
            <link>https://medium.com/sketch-app-sources/your-first-steps-to-creating-sketch-plugins-9cd0212de5f?source=rss-212bdd50c4a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cd0212de5f</guid>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[sketch]]></category>
            <category><![CDATA[plugins]]></category>
            <dc:creator><![CDATA[Kevin Gutowski]]></dc:creator>
            <pubDate>Mon, 27 May 2019 19:09:22 GMT</pubDate>
            <atom:updated>2019-05-27T19:09:22.781Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*TWEY3FVan66_4dbgEOrOSQ.gif" /></figure><p>Sketch plugins open up so many opportunities for creative and new ideas. As you probably have found, plugins can do a wide variety of things such as creating new layers, automating existing features, provide new interfaces, and more! Let’s dive into some of the very basics of plugin development and make some fun shapes along the way.</p><h4>The Script Panel</h4><p>Getting started is super simple. You don’t even need to download anything other than Sketch itself. Open up Sketch and navigate to Plugins &gt; Run Script...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*i0z-aUeiuQOp76eLAAuqpQ.png" /></figure><p>This is the script panel. It’s a little space to test your ideas quickly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*HDOz3wDXw2ejKPEywDFoZw.png" /></figure><h4>The JS API — Breaking down the example code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*ln8iDP_xpQuPff3DWiPQxQ.png" /></figure><p>Since the JS API is written in <em>Javascript</em>, lots of what you might know from building websites can translate over. If you haven’t written any <em>Javascript</em> before, that’s ok, I’ll be going over everything every step of the way.</p><p>Let’s look over that starter code. There is some awesome stuff going on there:</p><pre>console.log(&#39;This is an example Sketch script.&#39;)</pre><p>This logs some text (or String) to the console. You will often use console.log(&#39;something&#39;) for checking to make sure your code behaves as expected.</p><p>The next line is this</p><pre>var sketch = require(&#39;sketch&#39;)</pre><p>This is the way you import the JS API. It has all the translation bits to convert our <em>Javascript</em> objects into things that Sketch can understand.</p><pre>var document = sketch.getSelectedDocument()</pre><p>getSelectedDocument is a method defined from our variable sketch. It returns the selected document or null if there are no documents selected.</p><pre>var selectedLayers = document.selectedLayers</pre><pre>var selectedCount = selectedLayers.length</pre><p>Here we get the selected layers from the selected document. This is a very, very common pattern so be sure to remember that to get the selected layers you will need to do so through the document object. The length property gets the number of layers that are selected.</p><p><em>*One small note here for those that have a bit more Javascript experience: </em><em>selectedLayers isn’t an array but rather a </em><a href="https://developer.sketch.com/reference/api/#selection"><em>Selection class</em></a><em>. If you want to get an array of the layers selected you can do so with this:</em></p><pre>document.selectedLayers[0] // This doesn&#39;t work</pre><pre>document.selectedLayers.layers[0] // This does</pre><p>Last but not least, is checking to see if there are any layers selected and if so, logging the names of the layers.</p><pre>if (selectedCount === 0) {<br>    console.log(&#39;No layers are selected.&#39;)<br>} else {<br>    console.log(&#39;Selected layers:&#39;);<br>    selectedLayers.forEach(function (layer, i) {<br>        console.log((i + 1) + &#39;. &#39; + layer.name)<br>    })<br>}</pre><p>First, we check if the number of layers is 0. If true, then we log the String “No layers are selected.”</p><p>If the number of layers isn’t 0, we then log the String “Selected layers:” to help mark in the console what we are going to log later.</p><p>After that, for each layer we log the layer number and their layer name. More specifically, we use the forEach method on selectedLayers. We pass in a function which takes two inputs: the layer and the index. Since the first layer index starts at 0 we add 1 to it so we can get the log to look like this</p><pre>1. First Layer Name<br>2. Second Layer Name<br>etc...</pre><h4>Hit the Road Running</h4><p>Now that you know how the code works, hit the run button in the bottom right! If you had no layers selected then you should see the corresponding message in the console. If you did have some layers selected before running the scrip then you will see their names reported in the console. Pretty cool huh? Ah, we are just getting started…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*3gEwOcsQgaatOcE1MoCIvw.gif" /></figure><p>Let’s draw some shapes shall we? This is what we will make:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*qVezKBMM5y3qdS7wbIsIgg.png" /><figcaption>Oo purty shapes 🤩</figcaption></figure><p>In this next part we will learn how to create an artboard, make some shape layers, group them together, and reorder them. Follow along and let’s go!</p><ol><li><strong>Import Sketch &amp; Get Common Objects</strong></li></ol><p>Once you have your script panel open and ready to go, the first thing that we need to do is to import the JS API with. Remember, this is the translation part that the Sketch team upkeeps to make sure that the code you write here will translate to the correct underlying code.</p><pre>var sketch = require(&#39;sketch&#39;)</pre><p>Then, we will need to get the current document and page. These are the fundamental components of a Sketch document. Getting the selected document should look familiar since we did it earlier. Also, getting the selected page is very similar to getting the selected layers.</p><pre>let document = sketch.getSelectedDocument()</pre><pre>let page = document.selectedPage</pre><p><em>(Remember how to get the selected layers from the example earlier? </em><em>document.selectedLayers Getting the selected page is super similar.)</em></p><p>2.<strong> Create an Artboard</strong></p><p>The other neat thing that you can do with the JS API is to pull out various classes from it. I like to think of it like a utility belt which has lots of neat tools. Here is how we can pick one of them out:</p><pre>let Artboard = sketch.Artboard</pre><p>To use one of the tools we can initialize it like this:</p><pre>let myArtboard = new Artboard()</pre><p>and if you log myArtboard you will see that you successfully created an Artboard object!</p><h4>✔︎ Checkpoint</h4><p>What does myArtboard look like? Your code should look like this so far:</p><pre>let sketch = require(&#39;sketch&#39;)<br>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard()</pre><pre>console.log(myArtboard)</pre><p>And the output should look like this:</p><pre>{         <br>          type: &#39;Artboard&#39;,<br>            id: &#39;82732522-D929-4896-B98B-950E9E1EB7A8&#39;,<br>         frame: { x: 0, y: 0, width: 100, height: 100 },<br>          name: &#39;Artboard&#39;,<br>      selected: false,<br> exportFormats: [  ],<br> sharedStyleId: null,<br>        layers: [  ],<br>flowStartPoint: false,<br>    background: { <br>                 enabled: false, <br>        includedInExport: true, <br>                   color: &#39;#ffffffff&#39; <br>                } <br>}</pre><p>So now that we created the artboard you might be thinking, “Well… where is it exactly?” If you look underneath your script panel you should see that nothing got added to the canvas (you can also close the panel and look around to be sure).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*CgvLJwzhguRieGmQ602wPA.gif" /></figure><p>It turns out, that we will need to explicitly attach the artboard to the correct page. Otherwise, the artboard object that we made will be thrown away once the script is done running. This is why if you keep hitting the Run button over and over the unique id value of the artboard will change. Sketch is creating a brand new artboard object each time your script is executed.</p><p>To attach the artboard to the page we will need to specify a parent</p><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard()<br>myArtboard.parent = page</pre><p>Or if we want to be a bit more succinct about it we can pass the parent property when we initialize the artboard.</p><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard({ parent: page })</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlmsc_eVdSUR_0gf5DpEog.png" /><figcaption>Look! There it is! A marvelous artboard</figcaption></figure><p>Sweet! We got our artboard on our canvas. But, our artboard is a little small. In fact, the default size is 100 by 100. Perhaps you have an idea how to make the artboard larger already. If we look back to when we logged myArtboard then you might have noticed this property:</p><pre>frame: { x: 0, y: 0, width: 100, height: 100 }</pre><p>So to resize our artboard to 400px by 400px we can modify myArtboard like so:</p><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard({ parent: page })<br>myArtboard.frame = { x: 0, y: 0, width: 400, height: 400 }</pre><p>Which we can also move into the initializer:</p><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard({ <br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 }<br>})</pre><p>Nice work! By now you have clicked the Run button a few times and it’s likely that you have created a few artboards on top of one another. Or maybe you have been deleting them every time you wanted to run the code again. That is a bit tedious and something we can do programmatically! To clear everything within a page you can do this:</p><pre>page.layers = []</pre><p>If we add that before we create our artboard then each time you run the script the previously made artboards will be removed.</p><p>So if we put everything together so far we should have something like this:</p><pre>let sketch = require(&#39;sketch&#39;)<br>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>page.layers = []</pre><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard({<br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 }<br>})</pre><p>Great job! Now let’s add some shapes!</p><p>3. <strong>Creating a Square</strong></p><p>Creating a square is very similar to creating an artboard. We will specify a frame, a parent, and now a fill! Here is how we do it</p><pre>let ShapePath = sketch.ShapePath</pre><pre>let mySquare = new ShapePath({<br>    parent: myArtboard, <br>    frame: { x: 53, y: 213, width: 122, height: 122 },<br>    style: { fills: [&#39;#35E6C9&#39;]}<br>})</pre><p>Like we did with the Artboard class, let’s pick out the ShapePath class. To use the class we then create a new instance of ShapePath and pass in some setup properties — parent, frame, and style.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*Uy9BzJL8jezMLeAtXKz1Uw.png" /></figure><p>style is the newest of the bunch. If we take a look at the inspector panel inside Sketch we can kind of get an idea of what our code is doing.</p><p>When you select a layer, there are a bunch of properties like Resizing, Prototyping, Appearance, Style, Shadows, Inner Shadows, Blurs, etc. We want to add a fill which is under the Style property.</p><p>Fills can be disabled or enabled, have a blend mode, a hex value, and opacity. You can also have multiple fills as well!</p><p>Since you can have multiple fills the fill object holds a list of them, or an array. That looks like this:</p><pre>myFillsArray = [fill 1 ,fill 2, fill 3, etc]</pre><p>Or more specifically for our use like this:</p><pre>myFillsArray = [&#39;#00FF00&#39;, &#39;#FF0000&#39;,&#39;#0000FF&#39;]</pre><p>But since we really only want one fill we just need to pass in one hex value.</p><pre>style: { fills: [&#39;#35E6C9’]}</pre><p>Before we move on to creating other shapes I want to point out one subtle detail with frames:</p><pre>let mySquare = new ShapePath({<br>    parent: myArtboard, <br>    frame: { x: 53, y: 213, width: 122, height: 122 }<br>})</pre><p>Since we specified the parent artboard, the frame that we provide will be relative to the artboard that we made (it also inserts it inside the artboard as well). If we made the parent the page like we did when creating the artboard then its coordinates would be relative to the page.</p><h4>✔︎ Checkpoint</h4><p>So, to review what our code should look like at this step, it should look like this:</p><pre>let sketch = require(&#39;sketch&#39;)<br>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>page.layers = []</pre><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard({<br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 }<br>})</pre><pre>let ShapePath = sketch.ShapePath</pre><pre>let mySquare = new ShapePath({<br>    parent: myArtboard, <br>    frame: { x: 53, y: 213, width: 122, height: 122 },<br>    style: { fills: [&#39;#35E6C9&#39;]}<br>})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*VAqJHlSOxjrw673HDuRaYA.png" /><figcaption>That’s a nice square there.</figcaption></figure><p><em>*Note: If your square has a border around it then its likely that your Default Layer Style is causing this. To ensure that a border isn’t being drawn you will need to pass in an empty array for borders like so.</em></p><pre>style: { fills: [&#39;#35E6C9’], borders: []}</pre><p>4. <strong>Creating Other Shapes</strong></p><p><em>Triangles</em></p><p>Creating other shapes like triangles, pentagons, and circles are really similar to drawing rectangles. We need to specify a parent, a frame, and a fill (well a style that contains a fill). The only difference now is that we need to specify a ShapeType</p><pre>let myTraingle = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Triangle,<br>    parent: myArtboard,<br>    frame: { x: 84, y: 62, width: 98, height: 80 },<br>    style: { fills: [&#39;#00d5ffb3&#39;]}<br>})</pre><p>ShapePath contains an object called ShapeType. If you log ShapePath.ShapeType you can find a list of all the different types of shapes you can create. Here we want to use the Triangle option.</p><p>Also, you might have noticed that there is a funny looking Hex code here. Normally Hex codes are 6-digits in Sketch and correspond to R,G,B values (two digits for each color channel). 8-Digit hex codes have some extra bit of information and use the last two digits to encode opacity. Specifically, the b3 part of the string corresponds to 70% opacity.</p><p><em>*If you are looking do learn more about hex codes then check out these resources:</em></p><ul><li><a href="https://www.smashingmagazine.com/2012/10/the-code-side-of-color/"><em>The Code Side of Color</em></a> by Ben Gremillion</li><li><a href="https://medium.com/basecs/hexs-and-other-magical-numbers-9785bc26b7ee"><em>Hexes and Other Magical Numbers</em></a> by Vaidehi Joshi</li><li><a href="https://css-tricks.com/8-digit-hex-codes/"><em>8-Digit Hex Codes?</em></a><em> </em>by Chris Coyier</li></ul><p><em>Pentagons</em></p><p>Now that you know how to change the shapeType how might you be able to create a pentagon? The trick is to use the Polygon option.</p><pre>let myHex = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Polygon,<br>    parent: myArtboard,<br>    frame: { x: 218, y: 142, width: 120, height: 120 },<br>    style: { fills: [&#39;#FF00B366&#39;]}<br>})</pre><p>The default number of sides of a polygon is 5. Unfortunately, you can’t change the number of sides with the JS API just yet so we are stuck with hexagons for now.</p><p><em>Circles</em></p><p>Circles, of course, are created with the Oval shapeType. Hah! You thought it was going to be Circle, eh? I made the same mistake when writing this post out 🙃. In hindsight it makes sense though because ovals are more generic than circles. To create a circle rather than an oval we just make the width and height the same.</p><pre>let myCircle = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Oval,<br>    parent: myArtboard,<br>    frame: { x: 106, y: 102, width: 172, height: 172 },<br>    style: { fills: [&#39;#0006FF66&#39;]}<br>})</pre><p>This draws a circle perfectly fine, however we wanted a border rather than a fill.</p><pre>style: { borders: [&#39;#0006FF66&#39;] }</pre><p>This will create a 1px border. To specify a border width we will need to change things a little. Rather than just specifying a hex value for the border properties we also need to pass in the thickness.</p><pre>color: &#39;#0006FF66&#39;,<br>thickness: 16</pre><p>Putting it all together it looks like this:</p><pre>let myCircle = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Oval,<br>    parent: myArtboard,<br>    frame: { x: 106, y: 102, width: 172, height: 172 },<br>    style: { borders: [<br>        {<br>            color: &#39;#0006FF66&#39;,<br>            thickness: 16<br>        }<br>    ]}<br>})</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZ1WorAp-DDekdCobh_HsA.png" /><figcaption>Voilà! Your masterpiece is complete.</figcaption></figure><p><strong>Additional Topics</strong></p><p><em>Reordering Layers</em></p><p>Often times you want to put your shapes in exactly the right order. There are a few ways to go about doing this.</p><ul><li>Move the layer to the front or back</li></ul><pre>layer.moveToFront()<br>layer.moveToBack()</pre><ul><li>Move a layer forward/backward</li></ul><pre>layer.moveForward()<br>layer.moveBackward()</pre><ul><li>Specifying the index</li></ul><pre>let index = layer.index<br>//the layers current position</pre><pre>layer.index = 2<br>// assigning the index to a particular position</pre><p>Note that the layer at the back of the parent (visually) will be layer 0. The layer at the front will be layer n - 1 (if there are n layers).</p><p><em>Grouping Layers</em></p><p>Grouping layers will feel really similar to setting up an artboard. First we have to pull Group out like so:</p><pre>let Group = require(&#39;sketch&#39;).Group</pre><p>Just like creating an artboard, we create a new group like this</p><pre>var group = new Group({<br>    name: &#39;my name&#39;,<br>    layers: [myLayer1, myLayer2, etc..],<br>    parent: myArtboard<br>})</pre><p>Note that we don’t need to specify a frame here. The layers inside the group will determine the frame if we use a special little method called adjustToFit</p><p>However, if you attempt to add all your layers to a group at the end of the script that we have been working on you might notice some funny business.</p><pre>let Group = sketch.Group</pre><pre>let myGroup = new Group({<br>    name: &quot;My Group&quot;,<br>    layers: [mySquare, myTriangle, myHex, myCircle],<br>    parent: myArtboard<br>})</pre><pre>myGroup.adjustToFit()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KgwFWAc-FCMIdksTAuxLfA.gif" /><figcaption>Woah, its almost like we made a “Symbols” feature here.</figcaption></figure><p>Honestly, I’m not entirely sure what is going on here but somehow when making a new group and specifying the layers of that group, it is creating new instances of each layer rather than referencing the old layers that were initially created. There are a few ways to go about fixing this:</p><ol><li>Create the group object first. Then for each layer the parent should be the group rather than the artboard. <a href="https://gist.github.com/KevinGutowski/8a644a1c1b7aa5222635cf0df9bddc09"><strong>Link to code</strong></a></li><li>Don’t specify the parent when creating each layer. Putting them inside the group object will automatically assign the parent property for each layer for us. <a href="https://gist.github.com/KevinGutowski/6283a7a955030b78c08d0a1b925dda9b"><strong>Link to code</strong></a></li><li>Remove the parent for each layer before creating the group.<strong> </strong><a href="https://gist.github.com/KevinGutowski/46cecd65e4d5a305ee3b9197a81a44c7"><strong>Link to code</strong></a></li></ol><h3>Next Steps</h3><p>You have accomplished a lot so far! Now you might be wondering how to take it a step further. Here are a few suggestions:</p><ul><li>See what cool art you can make. If creative coding is something you want to dive into then I would highly recommend <a href="https://processing.org/">Processing</a>, a language dedicated to making graphics and animations programatically. (Here is a piece I made for this article)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYFYArxo7f9hs6YYVU3emQ.jpeg" /><figcaption>Code is at: <a href="https://gist.github.com/KevinGutowski/ca5e894770aff1a8371c37a83c9a6ff4">https://gist.github.com/KevinGutowski/ca5e894770aff1a8371c37a83c9a6ff4</a></figcaption></figure><ul><li>Learn more about the Sketch API. This is how I learned what functions and properties are available with each of the objects. <a href="https://developer.sketch.com/reference/api/">https://developer.sketch.com/reference/api/</a></li><li>Get involved in the community. Lots of designers and developers are asking questions and sharing code over at <a href="https://sketchplugins.com/">https://sketchplugins.com</a> and at <a href="https://spectrum.chat/sketch/plugins">https://spectrum.chat/sketch/plugins</a></li></ul><p>Lastly, if you have an idea for a plugin but just aren’t sure how to write it, share it in the comments below and I can point you in the right direction. If enough people have similar questions, I’ll write a blog post about it!</p><p>Until next time! 💎</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cd0212de5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/sketch-app-sources/your-first-steps-to-creating-sketch-plugins-9cd0212de5f">Your first steps to creating Sketch plugins</a> was originally published in <a href="https://medium.com/sketch-app-sources">Design + Sketch</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build your first Sketch plugin]]></title>
            <link>https://medium.com/@kevingutowski/how-to-build-your-first-sketch-plugin-14c0e9e56bf0?source=rss-212bdd50c4a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/14c0e9e56bf0</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[plugin-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[sketch]]></category>
            <dc:creator><![CDATA[Kevin Gutowski]]></dc:creator>
            <pubDate>Thu, 02 May 2019 05:06:09 GMT</pubDate>
            <atom:updated>2019-06-20T04:56:23.063Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*9pvrz0xH0U1CfqJ0ezS3_Q.gif" /></figure><p>Sketch plugins open up so many opportunities for creative and new ideas. As you probably have found, plugins can do a wide variety of things such as automate existing features, provide new interfaces, get data from external locations, and more! Let’s dive into some of the very basics of plugin development.</p><p>The only thing you need for this tutorial is a copy of Sketch. A little knowledge of Javascript won’t hurt either, but if not, that’s ok, I’ll be describing each step along the way. First, you will learn how to use Sketch’s script panel. By the end, you will have made a plugin that will create some awesome shapes and be well on your way to building plugins of your own.</p><h3>The Script Panel</h3><p>Getting started is super simple. Open up Sketch and navigate to Plugins &gt; Run Script...</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*ulaeeQL6XYCpVbnWerRQDA.png" /></figure><p>This is the script panel. It’s a little space to test your code quickly. Inside the panel you’ll find some example code already written for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*HDOz3wDXw2ejKPEywDFoZw.png" /></figure><p>Here is that code in a little nicer format in case you need it again.</p><pre>console.log(&#39;This is an example Sketch script.&#39;)</pre><pre>var sketch = require(&#39;sketch&#39;)</pre><pre>var document = sketch.getSelectedDocument()</pre><pre>var selectedLayers = document.selectedLayers<br>var selectedCount = selectedLayers.length</pre><pre>if (selectedCount === 0) {<br>    console.log(&#39;No layers are selected.&#39;)<br>} else {<br>    console.log(&#39;Selected layers:&#39;);<br>    selectedLayers.forEach(function (layer, i) {<br>        console.log((i + 1) + &#39;. &#39; + layer.name)<br>    })<br>}</pre><h4>Sketch’s JavaScript API — Breaking down the example code</h4><p>The Sketch JavaScript API is a way for us to interact with Sketch via code. Hereafter we will simply refer it to the JS API. With the JS API you can manipulate layer properties, select layers based on complex rules, export assets, and more!</p><p>To start things off let’s click the “Run” button and see what happens. This will help us get an idea what is going on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*FYJnb4r2RGJIpMNLR9wH4Q.png" /></figure><p>Once you click “Run” a few lines appeared in what is called the console.</p><pre>&#39;This is an example Sketch script.&#39;<br>&#39;No layers are selected.&#39;<br>Script executed in 0.119558s</pre><p>The first two lines are pieces of text and the last line tells us how quickly our script took to run. You will often see messages like this in the console. Other times you will see helpful error messages in debugging your code.</p><p>To get a better sense of how what is actually going on let’s look over the example code. The first line starts with this:</p><pre>console.log(&#39;This is an example Sketch script.&#39;)</pre><p>This logs some text (or a String) to the console. You will often use console.log(‘something’) for checking to make sure your code behaves as expected. This is how that first line in the console was printed.</p><p>The next line is this:</p><pre>var sketch = require(&#39;sketch&#39;)</pre><p>This is the way you import the JS API. We will need this bit if we want to interact with Sketch.</p><pre>var document = sketch.getSelectedDocument()</pre><p>getSelectedDocument() is a method defined on our object sketch. It returns the selected document or null if there are no documents selected.</p><pre>var selectedLayers = document.selectedLayers<br>var selectedCount = selectedLayers.length</pre><p>Here we get the selected layers from the selected document. This is a very, very common pattern so be sure to remember that to get the selected layers you will need to do so through the document object. The length property gets the number of layers that are selected.</p><p><em>*One small note here for those that have a bit more Javascript experience. </em><em>selectedLayers isn’t an array but rather a </em><a href="https://developer.sketch.com/reference/api/#selection"><em>Selection class</em></a><em>. If you want to get an array of the layers selected you can do so </em>by <em>using the Selection class’ </em><em>layer property:</em></p><pre>document.selectedLayers[0] // This doesn&#39;t work<br>document.selectedLayers.layers[0] // This does</pre><p>Last but not least, is checking to see if there are any layers selected and if so, logging the names of the layers.</p><pre>if (selectedCount === 0) {<br>    console.log(&#39;No layers are selected.&#39;)<br>} else {<br>    console.log(&#39;Selected layers:&#39;);<br>    selectedLayers.forEach(function (layer, i) {<br>        console.log((i + 1) + &#39;. &#39; + layer.name)<br>    })<br>}</pre><p>First, we check if the number of layers is 0. If true, then we log the text “No layers are selected.” If the number of layers isn’t 0, we then log the text “Selected layers:” to prefix the list of layer names that we are going to log.</p><p>After that, for each layer we log the layer index and layer name. More specifically, we use the forEach method on selectedLayers. We pass in a function which takes two inputs: the layer and the index. Since the first layer index starts at 0 we add 1 to it so we can get the log output to look like this:</p><pre>1. First Layer Name<br>2. Second Layer Name<br>etc...</pre><h4>Hit the Road Running</h4><p>Now that you know how the code works, hit the run button in the bottom right! See if you can trigger the different console messages. If you have no layers selected, then when you run the plugin you should see the text “No layers selected” in the console. If you did have some layers selected before running the script then you will see their names reported in the console. Pretty cool huh? Ah, we are just getting started…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*3gEwOcsQgaatOcE1MoCIvw.gif" /></figure><h3>Drawing Shapes</h3><p>Drawing shapes is one of my favorite things to do in Sketch. Some days though, even drawing rectangles is too hard. On those days I really wish Sketch could do that for me. Let’s see if we can build a plugin that helps me when I’m lacking some inspiration. This is what we will make:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*qVezKBMM5y3qdS7wbIsIgg.png" /><figcaption>Oo purty shapes 🤩</figcaption></figure><p>In this next part we will learn how to create an artboard, make some shape layers, group them together, and reorder them. Follow along and let’s go!</p><h4><strong>1. Import Sketch &amp; Get Common Objects</strong></h4><p>Once you have your script panel open and ready to go, the first thing that we need to do is to import the JS API. Remember, this is what helps us interact with Sketch.</p><pre>var sketch = require(&#39;sketch&#39;)</pre><p>Then, we will need to get the current document and page. To get the current page we use a method on sketch and get the selected page as a property on document.</p><pre>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><h4><strong>2. Create an Artboard</strong></h4><p>The other neat thing that you can do with the JS API is to pull out various useful Sketch objects from it. I like to think of the JS API like a utility belt which has lots of neat tools. In practice, you use it to pull out various classes from it. A class is a special type of function that organizes related functions and properties (you can learn more <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">here</a>). Here is how we pick out the Artboard class.</p><pre>let Artboard = sketch.Artboard</pre><p>Now, we can use the Artboard class — the tool we just pulled out — to create an actual instance of an Artboard:</p><pre>let myArtboard = new Artboard()</pre><p>and if you log myArtboard you will see that you successfully created an Artboard object!</p><h4>✔️ Checkpoint</h4><p>Let’s take a brief moment to see what we have written. Your code should look like this so far:</p><pre>let sketch = require(&#39;sketch&#39;)</pre><pre>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>let Artboard = sketch.Artboard<br>let myArtboard = new Artboard()</pre><p>It’s good practice to move dependencies, or the imported tools, to the top of the file. Let’s move the Artboard class to the top.</p><pre>let sketch = require(&#39;sketch&#39;)<br>let Artboard = sketch.Artboard</pre><pre>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>let myArtboard = new Artboard()</pre><p>One other thing we can check is to see what myArtboard looks like. If we add console.log(myArtboard) to the end of the script and hit “Run” the logged output should look like this:</p><pre>{         <br>          type: &#39;Artboard&#39;,<br>            id: &#39;82732522-D929-4896-B98B-950E9E1EB7A8&#39;,<br>         frame: { x: 0, y: 0, width: 100, height: 100 },<br>          name: &#39;Artboard&#39;,<br>      selected: false,<br> exportFormats: [  ],<br> sharedStyleId: null,<br>        layers: [  ],<br>flowStartPoint: false,<br>    background: { <br>                 enabled: false, <br>        includedInExport: true, <br>                   color: &#39;#ffffffff&#39; <br>                } <br>}</pre><p>So now that we created the artboard you might be thinking,“Well…where is it exactly?” If you look underneath your script panel you should see that nothing got added to the canvas (you can also close the panel and look around to be sure — as long as you clicked “Run” your written code will still be there for you when you open the script panel again).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*CgvLJwzhguRieGmQ602wPA.gif" /><figcaption>See how the id parameter keeps changing?</figcaption></figure><p>It turns out that we will need to explicitly attach the artboard to the correct page. Otherwise, the artboard object that we made will be thrown away once the script is done running. This is why if you keep hitting the Run button over and over the unique id value of the artboard will change. Sketch is creating a brand new artboard object each time your script is executed.</p><p>To attach the artboard to the page we will need to specify a parent:</p><pre>let myArtboard = new Artboard()<br>myArtboard.parent = page</pre><p>Or if we want to be a bit more succinct about it we can pass the parent property when we initialize the artboard.</p><pre>let myArtboard = new Artboard({ parent: page })</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlmsc_eVdSUR_0gf5DpEog.png" /><figcaption>Look! There it is! A marvelous artboard</figcaption></figure><p>Sweet! We got our artboard on our canvas. But, our artboard is a little small. In fact, the default size is 100 by 100. Perhaps you have an idea how to make the artboard larger already. If we look back to when we logged myArtboardthen you might have noticed this property:</p><pre>frame: { x: 0, y: 0, width: 100, height: 100 }</pre><p>So to resize our artboard to 400px by 400px we can modify myArtboard like so:</p><pre>let myArtboard = new Artboard({ parent: page })<br>myArtboard.frame = { x: 0, y: 0, width: 400, height: 400 }</pre><p>Which we can also move into the initializer:</p><pre>let myArtboard = new Artboard({<br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 }<br>})</pre><p>Nice work! By now you have clicked the Run button a few times and it’s likely that you have created a few artboards on top of one another. Or maybe you have been deleting them every time you wanted to run the code again. That is a bit tedious and something we can do programmatically! To clear everything within a page you can do this:</p><pre>page.layers = []</pre><p>If we add that before we create our artboard then each time you run the script the previously made artboards will be removed.</p><p>So if we put everything together so far we should have something like this:</p><pre>let sketch = require(&#39;sketch&#39;)<br>let Artboard = sketch.Artboard</pre><pre>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>page.layers = []</pre><pre>let myArtboard = new Artboard({<br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 }<br>})</pre><p>Great job! Now let’s add some shapes!</p><h4>3. <strong>Creating a Square</strong></h4><p>Creating a square is very similar to creating an artboard. We willspecify a frame, a parent, and now a fill! Here is how we do it:</p><pre>let ShapePath = sketch.ShapePath<br>let mySquare = new ShapePath({<br>    parent: myArtboard,<br>    frame: { x: 53, y: 213, width: 122, height: 122 },<br>    style: { fills: [&#39;#35E6C9&#39;]}<br>})</pre><p>We are already familiar with parent and frame. style is the newest of the bunch. If we take a look at the inspector panel inside Sketch we can get an idea of what our code is doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*Sm_5dUmfdMAKTnFbyZHY9Q.png" /></figure><p>When you select a layer, there are a bunch of properties like Resizing, Prototyping, Appearance, Style, Shadows, Inner Shadows, Blurs, etc. We want to add a fill which is under the Style section.</p><p>Fills can be disabled or enabled, have a blend mode, a hex value, and opacity. You can also have multiple fills as well!</p><p>Since you can have multiple fills the fill property holds a list of them (in code, a list is often called an array). That looks like this:</p><pre>style: { fills: [fill1, fill2, fill3, etc..]}</pre><p>But since we really only want one fill we just need to pass in one hex value.</p><pre>style: { fills: [&#39;#35E6C9’]}</pre><p>Before we move on to creating other shapes I want to point out one subtle detail with frames:</p><pre>let mySquare = new ShapePath({<br>    parent: myArtboard,<br>    frame: { x: 53, y: 213, width: 122, height: 122 }<br>})</pre><p>Since we specified the parent artboard, the frame that we provide will be relative to the artboard that we made (it also inserts it inside the artboard as well). If we made the parent the page like we did when creating the artboard then its coordinates would be relative to the page.</p><h4>✔️ Checkpoint</h4><p>So, to review what our code should look like at this step, it should look like this:</p><pre>let sketch = require(&#39;sketch&#39;)<br>let Artboard = sketch.Artboard</pre><pre>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>page.layers = []</pre><pre>let myArtboard = new Artboard({<br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 } <br>})</pre><pre>let ShapePath = sketch.ShapePath<br>let mySquare = new ShapePath({<br>    parent: myArtboard,<br>    frame: { x: 53, y: 213, width: 122, height: 122 },<br>    style: { fills: [&#39;#35E6C9&#39;]}<br>})</pre><p>Let’s move the ShapePath class up to the top to keep our dependencies together.</p><pre>let sketch = require(&#39;sketch&#39;)<br>let Artboard = sketch.Artboard<br>let ShapePath = sketch.ShapePath</pre><pre>let document = sketch.getSelectedDocument()<br>let page = document.selectedPage</pre><pre>page.layers = []</pre><pre>let myArtboard = new Artboard({<br>    parent: page,<br>    frame: { x: 0, y: 0, width: 400, height: 400 } <br>})</pre><pre>let mySquare = new ShapePath({<br>    parent: myArtboard,<br>    frame: { x: 53, y: 213, width: 122, height: 122 },<br>    style: { fills: [&#39;#35E6C9&#39;]}<br>})</pre><p>That is looking really great! If you click “Run” this is what should appear on the canvas:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*VAqJHlSOxjrw673HDuRaYA.png" /><figcaption>That’s a nice square there.</figcaption></figure><p><em>*Note: If your square has a border around it then its likely that your Default Layer Style is causing this. To ensure that a border won’t be drawn you will need to pass in an empty array for borders like so. This will likely be fixed in </em><a href="https://github.com/BohemianCoding/SketchAPI/issues/479"><em>later versions of the Sketch API</em></a><em>.</em></p><pre>style: { fills: [&#39;#35E6C9’], borders: []}</pre><h4>4. <strong>Creating Other Shapes</strong></h4><p><em>Triangles</em></p><p>Creating other shapes like triangles, pentagons, and circles are really similar to drawing rectangles. We need to specify a parent, a frame, and a fill (well a style that contains a fill). The only difference now is that we need to specify a ShapeType:</p><pre>let myTriangle= new ShapePath({<br>    shapeType: ShapePath.ShapeType.Triangle,<br>    parent: myArtboard,<br>    frame: { x: 84, y: 62, width: 98, height: 80 },<br>    style: { fills: [&#39;#00d5ffb3&#39;]}<br>})</pre><p>ShapePath contains an object called ShapeType. If you log ShapePath.ShapeType you’ll find a list of all the different types of shapes you can create. Here we want to use the Triangle option.</p><p>Also, you might have noticed that there is a funny looking Hex code here. Normally Hex codes are 6-digits and correspond to RGB values (two digits for each color channel). 8-Digit hex codes have some extra bit of information and use the last two digits to encode opacity. Specifically, the b3 part of the string corresponds to 70% opacity.</p><p><em>*If you are looking to learn more about hex codes then check out these resources:</em></p><ul><li><a href="https://www.smashingmagazine.com/2012/10/the-code-side-of-color/"><em>The Code Side of Color</em></a><em> </em>by Ben Gremillion</li><li><a href="https://medium.com/basecs/hexs-and-other-magical-numbers-9785bc26b7ee"><em>Hexes and Other Magical Numbers</em></a><em> </em>by Vaidehi Joshi</li><li><a href="https://css-tricks.com/8-digit-hex-codes/"><em>8-Digit Hex Codes?</em></a><em> </em>by Chris Coyier</li></ul><p><em>Pentagons</em></p><p>Now that you know how to change the shapeType how might you be able to create a pentagon? The trick is to use the Polygon option.</p><pre>let myHex = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Polygon,<br>    parent: myArtboard,<br>    frame: { x: 218, y: 142, width: 120, height: 120 },<br>    style: { fills: [&#39;#FF00B366&#39;]}<br>})</pre><p>The default number of sides of a polygon is 5. Unfortunately, you can’t change the number of sides with the JS API just yet so we are stuck with hexagons <a href="https://github.com/BohemianCoding/SketchAPI/issues/472">for now</a>.</p><p><em>Circles</em></p><p>Circles, of course, are created with the OvalShapeType. Hah! You thought it was going to be Circle, eh? I made the same mistake when writing this post out 🙃. In hindsight it makes sense though because ovals are more generic than circles. To create a circle rather than an oval we just make the width and height the same.</p><pre>let myCircle = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Oval,<br>    parent: myArtboard,<br>    frame: { x: 106, y: 102, width: 172, height: 172 },<br>    style: { borders: [&#39;#0006FF66&#39;] }<br>})</pre><p>Notice that we specify just the border and no fill. This will create a 1px border. To specify a border width we will need to change things a little. Rather than just specifying a hex value for the border properties we also need to pass in the thickness.</p><pre>color: &#39;#0006FF66&#39;,<br>thickness: 16</pre><p>Here is how we add those extra properties:</p><pre>let myCircle = new ShapePath({<br>    shapeType: ShapePath.ShapeType.Oval,<br>    parent: myArtboard,<br>    frame: { x: 106, y: 102, width: 172, height: 172 },<br>    style: { borders: [<br>        {<br>            color: &#39;#0006FF66&#39;,<br>            thickness: 16<br>        }<br>    ]}<br>})</pre><h4>✔️ Final Checkpoint</h4><p>We have put everything together now! You can check your code below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/407ac87507915ed41d11059280d2b013/href">https://medium.com/media/407ac87507915ed41d11059280d2b013/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*VMtnne9c9JvZSkMDCSYEkA.png" /><figcaption>You did it! Congrats!!</figcaption></figure><p>If you want to save your script as a plugin you can do so with the “Save Script As Plugin” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vwUsmGkWO0n6T79fiIoJEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dR-57DKJ1_Ig5JVCdO-1Xg.png" /></figure><p>A quick word of caution though before you do so. Because we are resetting all the layer contents of our document each time with page.layers = [] (on line 8) it can be pretty destructive to any documents that have actual work in them. As such, you might want to remove that line before converting your script to a plugin.</p><p>One you do save your script as a plugin it will appear under Plugins &gt; Your Plugin Name &gt; Your Plugin Name . We’ll cover how to edit this saved plugin in another article. For now, great work on making your first plugin! The next section covers some additional concepts that are extremely helpful when managing created layers.</p><h3>Additional Topics</h3><h4><em>Reordering Layers</em></h4><p>Often times you want to put your shapes in exactly the right order. There are a few ways to go about doing this.</p><ul><li>Move the layer to the front or back</li></ul><pre>layer.moveToFront()</pre><pre>layer.moveToBack()</pre><ul><li>Move a layer forward/backward</li></ul><pre>layer.moveForward()</pre><pre>layer.moveBackward()</pre><ul><li>Specifying the index</li></ul><pre>let index = layer.index<br>//the layers current position</pre><pre>layer.index = 2<br>// assigning the index to a particular position</pre><p>Note that the layer at the back of the parent (visually) will be layer 0. The layer at the front will be layer n -1 where n is the total number of layers in the parent.</p><h4><em>Grouping Layers</em></h4><p>Grouping layers will feel really similar to setting up an artboard. First we have to pull Group out like so:</p><pre>let Group = require(&#39;sketch&#39;).Group</pre><p>Just like creating an artboard, we create a new group like this:</p><pre>var group = new Group({<br>    name: &#39;my name&#39;,<br>    layers: [myLayer1, myLayer2, etc..],<br>    parent: myArtboard<br>})</pre><p>Note that we don’t need to specify a frame here. The layers inside the group will determine the frame if we use a special little method called adjustToFit()</p><pre>let myGroup = new Group({<br>    name: &quot;My Group&quot;,<br>    layers: [mySquare, myTriangle, myHex, myCircle],<br>    parent: myArtboard<br>})</pre><pre>myGroup.adjustToFit()</pre><p>However, if you attempt to add all the layers to a group at the end of the script that we have been working on you might notice some funny business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KgwFWAc-FCMIdksTAuxLfA.gif" /><figcaption>Woah, its almost like we made a “Symbols” feature here.</figcaption></figure><p>Honestly, I’m not entirely sure what is going on here but it seems related to the fact that the layers have more than one parent (one to the artboard and other to the group). To fix this, ensure that the layer you’re adding to a group doesn’t already have a parent. If it does, you’ll need to remove it from its existing parent first using remove(), <em>then </em>adding it to it’s new parent. (<a href="https://github.com/BohemianCoding/SketchAPI/pull/486"><em>This is actually a bug</em></a><em>)</em></p><pre>let myLayers = [mySquare, myTriangle, myHex, myCircle]</pre><pre>// remove the parent for each layer<br>myLayers.forEach(layer =&gt; layer.remove())</pre><pre>let myGroup = new Group({<br>    name: &quot;My Group&quot;,<br>    parent: myArtboard,<br>    layers: myLayers<br>})</pre><pre>myGroup.adjustToFit()</pre><h3>Next Steps</h3><p>Congratulations! 🎉 You have accomplished a lot so far! Now you might be wondering how to take it a step further. Here are a few suggestions:</p><ul><li>See what cool art you can make. If creative coding is something that you want to dive into then I would highly recommend <a href="https://processing.org/">Processing</a>, a language dedicated to making graphics and animations programatically.(Here is a piece I made for this article)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DbAGqj9xnj-JO2h8k0QuUA.png" /><figcaption><a href="https://gist.github.com/KevinGutowski/ca5e894770aff1a8371c37a83c9a6ff4">Link to code &gt;</a></figcaption></figure><ul><li>Learn more about the <a href="https://developer.sketch.com/reference/api/">Sketch JS API</a>. This is how I learned what functions and properties are available with each of the objects.</li><li>Get involved in the community. Lots of designers and developers are asking questions and sharing code over at the <a href="https://sketchplugins.com/">Sketchplugins</a> forum and on <a href="https://spectrum.chat/sketch/plugins">Spectrum</a>.</li></ul><p>Lastly, if you have an idea for a plugin but just aren’t sure how to write it, share it in the comments below and I can point you in the right direction.If enough people have similar questions, I’ll write a blog post about it!</p><p>Until next time! 💎</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14c0e9e56bf0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pandas for Designers]]></title>
            <link>https://medium.com/@kevingutowski/pandas-for-designers-a0189ca471b0?source=rss-212bdd50c4a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0189ca471b0</guid>
            <category><![CDATA[data-processing]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[designing-with-data]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Kevin Gutowski]]></dc:creator>
            <pubDate>Fri, 06 Jan 2017 04:31:43 GMT</pubDate>
            <atom:updated>2017-01-06T05:08:39.802Z</atom:updated>
            <content:encoded><![CDATA[<p>Using “live” or realistic data in designs has become fairly popular due to plugins such as <a href="https://github.com/preciousforever/sketch-data-populator">Sketch-data-populator</a>, <a href="https://www.invisionapp.com/craft">Invision’s Craft plugin</a>, and many others. While these tools are a great first step I don’t think they really address the problem properly, which is, <strong>How well will my designs respond to user data?</strong></p><p>Choosing some random user names or titles from your dataset won’t give you the full insight of how your end users will end up using your product. Because of this when I “design with data” I never copy-paste data from my product’s database inside my Sketch mocks. It tends to look more like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEJy9-wXVpuVsD0mx0Z56A.png" /><figcaption>Above is a color coded representation of Course Name character length. The blue represents the average character length while the red is one standard deviation away. This allows me to get a sense of how users intend to describe their Course Name so that I can give enough space to display this data point throughout the app.</figcaption></figure><p>When designing for your users picking an ideal use case and designing around it is just the start. You must consider all users and specifically make design decisions that are appropriate for each. Designing for every user can seem daunting however<strong> </strong>Pandas (a python library) and a bit of statistics can help gain some insights.</p><h3>The Lay of the Land</h3><p>When working with large amounts of data its best to try and look at it from many different perspectives. Basic statistics can help us here. You are probably most familiar with an average.</p><p>An average, or mean, is defined as summing all your data points and dividing by the number of data points that you have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*od7_oSUnWjHqUlJlXckDJg.png" /><figcaption>Given a set of digits, the average is the sum of all the digits divided by the number of digits in the set.</figcaption></figure><p>When you add a large number of points — for example perhaps the number of times a user clicks the login button within a month — you could expect some sort of distribution like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*QgQF1OobWppLR3poHHbyLg.png" /></figure><p>Which you can start to see that the average becomes a little less useful in describing our distribution. Another common data point to examine is the mode or the most common occurring value. In our case that would be where the chart is at its highest — at 2.</p><p>Other useful values are the minimum and maximum and give you an upper and lower limit to your data.</p><p>Last, but certainly not least, is the standard deviation. The standard deviation informs you of the “spread” of the data points. It tells you if your data is clumped together around the average or if it is spread out. Given two distributions (see the figure below), the one with the wider spread of data points will have a greater distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*DWs-daMq8IgfJ75fxk7y7A.png" /><figcaption>The greek letter sigma (𝝈) is often used for standard deviation. You can see here that the blue distribution is a bit fatter than the skinny red curve and thus has a larger standard deviation.</figcaption></figure><p>I won’t go into the details of how its computed (though if you are curious here is a <a href="http://www.mathsisfun.com/data/standard-deviation.html">funny exercise with dog heights</a> that works through the computation) because all you need to know is that its related to how widely spread your distribution is. This is an important data point because it can reveal how varied something is.</p><p>Now that you know some of the basics of statistics, lets get started in actually processing data.</p><h3>Escaping Flatland</h3><p>There are many ways to go about processing user data. Some companies attempt to do the processing for you such as <a href="https://heapanalytics.com/">Heap Analytics</a> (however most of them just help you with the number of clicks something gets rather than process database info). If you are doing it manually, SQL or Structured Query Language, is often used to retrieve and process data. I use <a href="https://jupyter.org/">Jupyter</a> Notebooks, little documents that contain code and visualizations, and <a href="http://pandas.pydata.org/">Pandas</a>, a python data analysis library. Using python makes it much easier to visualize the data by creating histograms and charts. Moreover, you can utilize complex logic that isn’t easily expressed in SQL. While you do have to download the data from the servers (often with SQL), its ok if we aren’t working with realtime data.</p><h4>Setup</h4><p>To get started you’ll need to have python installed. There are many ways to go about doing this however I think the simplest (and way I end ended up having success with) is installing python via <a href="https://www.continuum.io/downloads">Anaconda</a>. Once you have installed Anaconda you’ll also have Jupyter installed as well.</p><p>Lastly, create a folder on your computer where you would like to store your notebooks. This folder will also contain the raw user data. Personally, I’m still learning how to pull data in from an external server — lots of people use the aforementioned SQL. I usually work with one of my developers to get the raw user data (which is in some sort of column format: json, csv, etc.). Once you have that, you can put that in the folder as well. If you would like to follow along with some example data you can download that <a href="https://www.dropbox.com/s/zxza132ljcdlcbc/myData.csv?dl=0">from here</a>.</p><p>Open up terminal (or your favorite terminal emulator of choice) and navigate to the folder you just created. If you have never used terminal before, now worries (<a href="https://www.youtube.com/watch?v=Vhcx4KJbtes">here is an intro</a>)!</p><p>You can watch that video but you really only need to know 3 commands.</p><pre>ls // Display current folder contents</pre><pre>cd .. // Goes up a folder</pre><pre>cd folderName // Goes down into a folder (tab for autocomplete!)</pre><p>Once you have navigated to your folder with the data contents start up the notebook server with the command:</p><pre>jupyter notebook</pre><p>This will open up your browser and it should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*P6H3toKkBDcWnOL66bsIfg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*4pOP5NOIoU_WevkWQ-xBig.png" /></figure><p>Up in the right corner you can see a button titled “New” which you can create a new python notebook from. This will open a new tab with the new file you created.</p><p>And thats it! You are ready to go anyalze some data!</p><h4>Doing the Data</h4><p>Now that we are all setup we can get to processing some data. To start off, I always begin my files with importing the correct libraries and adding in my data. I do this by importing pandas and read in my csv file. To get a sense of what data I have, I’ll print off a snippet of the file along with some basic stats. You should type something similar into your notebook:</p><pre><strong>import</strong> pandas <strong>as</strong> pd<br><strong>%</strong>matplotlib inline<br>df = pd.read_csv(&#39;myData.csv&#39;)<br><strong>print</strong> df.describe()<br>df.head()</pre><p><strong>Shift + Return</strong> will run the code and you should get something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bGOCTDGZYhz7nKx1eAFidA.png" /></figure><p><strong>%matplotlib inline </strong>helps display our charts, you guessed it, inline. You’ll need this if you want to easily view your output.</p><p><strong>df.describe() </strong>returns a nice analysis of number-type things (I’m being vauge because it can handle <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.describe.html">lots of different data types</a>). It returns the number of items (count), the average (mean), standard deviation, minimum / maximum, as well as % markers. This is pretty much all the data types we covered in the intro!</p><p>In the instance above, the info from Student ID Numbers is a bit meaningless because they are just generated numbers however the Grade column is pretty useful as you can see an average <em>~3.55 </em>and standard deviation <em>~1.1</em>.</p><p><strong>df.head()</strong> returns the first four rows of data. This is often useful to get a visual sense of what type of data is contained in your datafile. I often use this a quick reference for figuring out how to process the data without having to open it up in excel.</p><p>You can easily plot out a column of data with <strong>df[‘column_name’].hist(). </strong>Move down to another input field and execute something like this (don&#39;t forget, shift + enter will run the code):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1C8_Iu7C8XF83OCxPMwJ_g.png" /></figure><p>The histogram’s binning is a little off and if we specify the number of bins that we want we can get it to look a little bit nicer (often, you can use the max of your data as the number of your bins).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dzEic2y5_03wAZYbWdb3CA.png" /></figure><p>With <strong>.describe()</strong> and <strong>.hist()</strong> you can get a really good sense of what patterns there are within the data.</p><h4>Determining Character Length</h4><p>A common thing that I do when designing is considering the different states a particular element can be in and how much space I need to give to that element. Character length is a powerful data point to look at as its directly correlated to the visual representation of that data. It determines how much spacing I need to consider giving an element, how that data might have to break if its too long, or how often there is no data at all.</p><p>For example, if I am designing a table that displays user names, real names, SID, and email addresses I want to know the expected width each column needs to have. To get a sense of how long a particular column is we can look at character length.</p><p>Anywho, back to determining character length! To look at character length we will need a bit more code. For each data point in a given column we need to find the length of that data point.</p><pre>df[&#39;new_column_name&#39;] = [len(x) for x in df[&#39;data_column&#39;]]</pre><p>To see what the email length looks like, we look at the length of each item in our list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yz3ezn_Vg4ocmcQV6bNK3A.png" /></figure><p>We can now see that the average email length is about 26 characters and one standard deviation away from the average is +/- 3 characters. Which gives us a range of [23,29]. Awesome! Unfortunately, this isn’t that much different than the [min,max] which is [22,30] which means that the standard deviation isn’t that useful. Part of the reason for this is that my example data doesn’t have enough data points. You can see that the count is only 20.</p><p>Here’s an example from Gradescope (the company that I work at) where the count is much higher:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ZfB1AmlB6uOAyc9LCUyKg.png" /><figcaption>Here I am examining how long course titles are on Gradescope. While there are a lot of really short names some users attempt to put a much longer one!</figcaption></figure><p>With a much larger count the data structure becomes more prominent. Here, the average is around 9 characters long with a deviation of +/- 5. To help process what this means for my designs I can represent the data like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mtBfkoBJYbmdyjAmXDaf6g.png" /></figure><p>I attempt to convert the character length to a pixel length underneath the text. Of course, this is a rough approximation as different characters, fonts, and letter-spacing will vary the actual pixel representation. However, I still find this information immensely useful in figuring out how much space I should give and how I should handle the truncation of the text. If I realize I can prevent truncating of text for 20% more users just by adding a few pixels to the width of the container then I’ll do it!</p><p>Another thing that I added to the representation above is an example of what the data might look like. Rather than using random characters I faked what the data looks like — MATH 10A LEC 005 Fall 2015. I haven’t quite figure out how one would go about coding this but by looking at the<strong> .head() </strong>of the table and by querying a few examples, I was also able to recognize a common pattern and included it in the graphic.</p><h4>Other Techniques</h4><p>Occasionally you’ll want to look at a subset of data to get a better view. To do this you’ll need to create a different series [using <strong>pd.Series()</strong>]<strong> </strong>because of the change in length of the data set.</p><pre>myVariable = pd.Series([x <strong>for</strong> x <strong>in</strong> df[&#39;data_column&#39;] <strong>if</strong> x &lt; 30])<br>myVariable.hist()<br>myVariable.describe()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*LpS49pdubeoQyu-kPz6ELQ.png" /></figure><p>This is also useful when the data is heavily skewed in one direction and you want to look at less conventional usage. I often find that outliers or “unusual” usage more interesting than the averages because its these users that are stretching your product in different ways. For example, if a particular course has lots of really long assignment titles perhaps they are trying to overcome some feature or lack of features in the product. Reaching out to these users often can lead to insights that drive future product decisions.</p><h4>Seaborn</h4><p>Once you get the hang of Pandas I would highly recommend checking out <a href="https://stanford.edu/~mwaskom/software/seaborn/">Seaborn</a>, a data vis library from Stanford, which allows you to easily create data rich charts. With a few lines of code you can get some really awesome looking graphs (I personally really like the <a href="https://stanford.edu/~mwaskom/software/seaborn/examples/grouped_violinplots.html">violinplots</a>)!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ddFVXkxjA4oLiD9TtrKLFw.png" /></figure><h3>With More Tools Comes More Responsibility</h3><p>As a designer its important to know when you’ve gone too far with any tool. While it is fun to put on the data scientist hat and dive deep into data visualizations, it can be a distraction from the problems you are trying to solve.</p><p>It will take time to try and fit data science into your workflow and your team’s. Perhaps you are at an early startup and don’t have much user data so you’ll prioritize user interviews more than usage stats. Or maybe you are at a larger company with a design team and the time you take to understand specific data points will bring clarity on how you want to approach a redeisgn.</p><p>In my experience (at a small startup) I have found a few kew points when working with data:</p><ul><li>It’s never straightforward to turn correlations into causations. It often takes more time than you expect to develop a sense what data ultimately affects users. Moreover, just because you have access to the data and can display it in various ways doesn’t mean that it will solve your design problem. You’ll have to connect the dots in a way that your team can agree upon.</li><li>Prioritize, prioritize, prioritize. Just like any tool that a designer uses, you’ll need to weigh the cost of finding &amp; presenting this data with other things that you can be doing such as user testing or just moving on to other higher priority tasks. As your skills grow and your product matures perhaps spending more time during the research phase will result in greater returns than if you are just starting out.</li></ul><h3>Thanks &amp; Further Reading</h3><p>Thanks so much for taking the time to read this and I welcome any feedback that you have! I would love to know what sort of data points that you find interesting and has helped you with your design work. Big thanks to my coworker Sergey for helping me out getting setup &amp; helping me along the way.</p><p>If you are looking for some more ideas about data visualization then I highly recommend checking out the book “Envisioning Information” or “The Visual Display of Quantitive Information” both by Edward Tufte. They are fantastic pieces of inspiration that I continue to reference back to.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0189ca471b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Iteration (and Compromise)]]></title>
            <link>https://medium.com/@kevingutowski/iteration-and-compromise-20560b075930?source=rss-212bdd50c4a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/20560b075930</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[process]]></category>
            <category><![CDATA[iteration]]></category>
            <dc:creator><![CDATA[Kevin Gutowski]]></dc:creator>
            <pubDate>Sat, 30 Apr 2016 17:52:58 GMT</pubDate>
            <atom:updated>2016-06-27T17:56:57.217Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9imDVWF6HMp50UbrXmSVQ.jpeg" /></figure><p>A year ago I was just starting out with design. I did a few projects, skimmed over dribbble, and read design articles. Often, these articles would explain how important iteration means to your designs. So I heeded their advice and within my Sketch files I would go wild with tons of different design styles and versions of the same thing. As someone just starting out I think it was good to go through all those designs. I’d see how contrast &amp; rhythm would change with different font weights, colors, and spacing. It’s something I still do, but perhaps I just do a good chunk of it in my head nowadays. However, after hundreds upon hundreds of artboards, I have come to realise that iteration isn’t about how many designs I can come up with. Rather, it starts and ends with one of the most fundamental units in product design: <strong>a user story</strong>.</p><p>Creating and managing user stories is one of the most common tasks I’ll do at <a href="https://medium.com/u/7396c2a2c12f">Gradescope</a>. User stories are great because they are dense bits of information that contain actionable feedback. They are things that your users want to accomplish and its these needs that drive the development of the product. If you are a little unfamiliar with user stories<strong>*</strong> they look something like this,</p><p><em>As a</em><strong> grader</strong>, <em>I want to</em> filter the students I have to grade by section <em>so that I </em>can grade the students in my section.</p><p>At Gradescope, we have lots of these stories. Every time a user emails us with a problem or some piece of feedback we attach their names to stories relevant to their issue. Moreover, we organize these stories into flows using a web app called <a href="https://clubhouse.io/">Clubhouse</a> (its similar to Pivotal Tracker).</p><p>Here’s the details on how this works:</p><p>These newly created stories can exist in either a Design flow or a Dev flow. The Design flow contains stories that need to go through the hands of designers before they can make it over to the Dev flow. The Dev flow contains completed user stories from the Design flow as well as chores, bugs, and user stories that don’t need go through the Design flow. Each of these Projects also contain different statuses such as <strong>In Development</strong>, <strong>Ready for Review</strong>, or <strong>Completed</strong>. This way, a story can navigate from <strong>In Development</strong> to <strong>Completed</strong> within the Design flow and be <strong>Ready for Development</strong> within the Dev flow<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6-dwqS2QvVWhykDIzdX9hQ.png" /><figcaption>Clubhouse offers many ways to filter and view user stories however my favorite view is this one here. You can see each of the stores organized in their different states of activity. The stories move from Unscheduled all the way over to Completed (then later archived).</figcaption></figure><p>It’s a bit hard to describe the exact process but the importance here is the <strong>movement of these stories</strong>. As these stories move through Clubhouse, each step they slightly change. They change when a designer maps out the solution space. They change when new technical constraints are laid out by a developer. They change from feedback given by the CEO or from user testing or a new email from an investor. This is the iteration that those designers were originally talking about in those articles.</p><p>It’s less about coming up with hundreds of versions in the beginning and more about the hundreds of versions that you will make in response to these slight changes in the user stories. These changes will force you to make design decisions that stray from your original ideas and sometimes it will feel like you are making a compromise. It’s totally ok to feel this way! Discussing these compromises with your coworkers is the bread and butter of a designer’s job. It’s what makes your app better. Ultimately, its what makes you a better designer.</p><p><strong><em>*</em></strong><em>If you are looking for some more guidance on how to make awesome user stories </em><a href="https://medium.com/u/ea435de9d450"><em>Heddy Stern</em></a><em> has a great writeup on creating effective user stories.</em></p><p><a href="https://medium.com/p/50c7b127bb26">This is what my user stories look like</a></p><p><em>Also, </em><a href="https://medium.com/u/d039b1ad230c"><em>Catriona Cornett</em></a><em> has sweet article on managing Usability Debt. I do think Clubhouse is a better way to track it than using an excel sheet though!</em></p><p><a href="https://medium.com/p/6b8693e6e853">How to Effectively Address the Usability Debt Within Your Product</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20560b075930" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing Tomorrow’s Physics Education]]></title>
            <link>https://medium.com/@kevingutowski/designing-tomorrows-physics-education-9cf92091a030?source=rss-212bdd50c4a8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cf92091a030</guid>
            <dc:creator><![CDATA[Kevin Gutowski]]></dc:creator>
            <pubDate>Tue, 13 Jan 2015 01:15:15 GMT</pubDate>
            <atom:updated>2015-07-30T17:09:56.990Z</atom:updated>
            <content:encoded><![CDATA[<h2>&amp; Beyond</h2><p>Physics is hard. Getting a degree in Physics is especially difficult. As an undergrad about to graduate from <a href="http://physics.berkeley.edu/">Cal</a> with a degree in it, I think there are a few things that can be done differently with how modern technologies are being integrated into the curriculum. Inspired by this, I have come up with a platform to better communicate Physics as a whole— from the textbooks, to the course requirements, to getting research. It’s not just a glorified ebook or an event calendar but rather a whole new way of organizing and meeting the needs of a Physicist. While this design focuses on Physics @Cal many concepts can easily be applied to other higher education fields such as Mathematics, Chemistry, etc. Now before we dive in there’s a few things you need to know.</p><h3>The Context</h3><p>Things are a bit convoluted at the moment. Brought on by <a href="http://oe.berkeley.edu/programs/oe-program">Operation Excellence</a>, UC Berkeley is undergoing a complete overhaul of it’s web systems across the board. For mail there was the transition from <em>Roundcube </em>and <em>SquirrelMail </em>to <em>bMail </em>which is hosted and managed by Google. Departments are reexamining their websites and are getting a fresh coats of paint by moving towards a trendy graphic centered design.<em> bSpace</em>, UC Berkeley’s website for getting homework and updates on classes, is being replaced by <em>bCourses</em><strong><em> </em></strong>(managed by <a href="http://www.instructure.com/">Canvas</a>) which tries to solve hierarchy issues of the old.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_lA8iiJdEe1jyhmuBXN93Q.jpeg" /><figcaption>Transitions from older technologies to the current, newer ones. There’s Roundcube to bMail, the old Physics Department webpage to the new one, and bSpace to bBcourses.</figcaption></figure><p>In addition to these updated systems, there are also the old ones that have yet to be updated. At minimum an undergraduate physicist at Cal would have to interface with <em>bSpace</em> (hopefuly not much longer), <em>bCourses</em>, textbooks, <em>bMail,</em> the physics website, <a href="https://bearfacts.berkeley.edu/bearfacts/"><em>BearFacts</em></a><em>, </em><a href="http://registrar.berkeley.edu/telebears_access.html"><em>Telebears</em></a><em>, </em>and lastly your college website (either <a href="http://engineering.berkeley.edu/">Engineering</a> or <a href="http://ls.berkeley.edu/">L&amp;S</a>). It’s a lot to take in and manage on your own. That’s not to mention anything of Facebook pages or university webpages. Often times the experience is very patched together with a strong sense of old paradigms holding these systems back. It’s also not quite clear who the end user is in each case and can vary amongst the websites. The new updates to some of the systems are great however none of them take the opportunity to revolutionize undergrad education. It’s like a fresh coat of paint on a old car. The problems are still there. This led me to ask the question…</p><blockquote>What does the future of education look like?</blockquote><h3>User Research</h3><p>I’ll be honest that I first didn’t approach this issue with the larger perspective as I do now. I was mainly focused on Physics and most of the user research that I did in the beginning was talking amongst my peers about what sorts of things they didn’t like about <em>bSpace</em> or the PDFs we were given in a particular class. We would exchange annoyances about the learning process with one another and grumble about the new layout of <em>bCourses. </em>There were also day to day issues that I would pick up on such as only bringing one textbook a day to do homework because you physically couldn’t bring two of them to campus. The most common solution I have seen is to have crappy, scanned copies of ones textbooks on an iPad or tablet in addition to lugging one of the large textbooks around. This way your back thanks you in addition the PDFs work in a pinch if suddenly a bunch of your classmates decide to work on Quantum Mechanics and you don’t have a hard copy with you.</p><p>Another thing that I have found is that class notes are less utilized than reading the textbook. This has to do with the fact that most of the time the professor lectures on material that is covered in the book and most of the time homework problems come from questions in the textbook. I’m definitely not saying that lecture is not helpful but rather that it is not something that is constantly referenced multiple times a week. In addition, most of the confusion that my peers and I found ourselves in was linking the material covered in lectures with the material covered in the textbook. For example, in my Analytic Mechanics course we learned small angle solutions to the double pendulum in class using a particular lagrangian. When it came to doing a similar problem on the homework, my peers and I couldn’t quite utilize our notes properly because the textbook (which the question originated from) solved the system slightly differently. It’s a small question and thus probably wouldn’t have been brought up in office hours. These discrepancies came about fairly often and while they weren’t detremential to understanding the material it would have been nice to get clarification for the smaller details that require specific context.</p><p>The most common web tool used in Physics is <em>bSpace </em>and <em>bCourses </em>(with <em>bCourses</em> being the newer of the two<em>)</em>. Both are used in the same way—post grades, announcements, a syllabus, and homework/review sheets. I like to think of it as a bulletin board for professors. It works fine however it leaves a lot of work on the professor/GSIs (graduate student instructors) to fill content out and keep things updated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7hjZD_Ku6FsmBGXACXzow.png" /><figcaption>The empty bSpace page for my Analytic Mechanics course.</figcaption></figure><p>Things feel empty and even though the new <em>bCourses</em> allows for more conversations to happen amongst classmates it’s hidden within submenus. Because of this, most of the discussions I have are limited to the classmates that I am friends with on Facebook or have their cell number to text. Keep in mind these are also brief discussions due to the fact that physics equations don’t translate nicely to chat interfaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*OASScB8QjVNNo7QdIbKoXw.png" /><figcaption>The lengths that Phyicists have to go to do discuss a question online is quite insane. With a liberal use of parentheses and images conversations are usually kept short due to the difficulty. It’s quite ridiculous, frankly.</figcaption></figure><p>Ultimately, these types of issues manifest themselves in many aspects of a Physics undergrad career. While they might seem small, the friction between the analog practices of the old (what the professors are used to) and the digital communcation of the new (what students are used to) is left to be swallowed by the undergraduates.</p><p><em>Side note: If you are curious what kind of digital technologies there are for higher education in Physics, its pretty slim. In my experience the best that Physics has to offer is over at </em><a href="http://hyperphysics.phy-astr.gsu.edu/hbase/hph.html"><em>Hyperphysics</em></a><em>, </em><a href="http://www.feynmanlectures.caltech.edu/"><em>The Feynman Lectures</em></a><em>, and </em><a href="http://www.pearsonmylabandmastering.com/northamerica/masteringphysics/"><em>Mastering Physic</em></a><em>s.</em></p><h3>The Main Focus</h3><p>With this in mind I feel that there are three key areas for improvements in higher education technologies.</p><ol><li>Making the reading experience approachable and connected through the use of clean design, links, and integrated comments.</li><li>Providing an easy way to communicate with ones peers using common terminology and symbols so that the barrier to having a technical discussion online is removed.</li><li>Providing a space where students can effectively see their progress as a Physics major and communicating all the available campus resources.</li></ol><p>Current technologies are either underpowered, underutilized, or unapproachable. They feel like small additions that don’t quite understand the background for which they are being used in. As such, the function and style should reflect the fact that its a social learning tool rather than a corporate dropbox.*</p><p><em>*dropbox as in a file uploader — I </em>❤<em> Dropbox.</em></p><h3>The Ansatz &amp; The Start of A Solution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eHaGoD9x71HPchKywFPhig.jpeg" /><figcaption>The main book view of The Ansatz.</figcaption></figure><p>While I wanted to keep the design clean and modern I wanted to reflect the qualities of a Physics textbook. In addition to being a free web font, I chose Adobe Garamond Pro for the content text because this serif font mimics the bold typography found in many Physics textbooks and makes the material readable, familiar, and ultimately beautiful. For the color scheme I chose to go a similar blue hue found on the cover of many Physics books (<a href="http://www.amazon.com/Introduction-Quantum-Mechanics-2nd-Edition/dp/0131118927">Griffiths</a> in particular). The blue I choose was a bit brighter than most of the books because I wanted the platform to feel less of a corporate place but rather a more playful and exciting enviornment to learn. Also, if you examine closely, the font color isn’t black but rather a golden dark grey that gives a bit a warmth to the text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*KfWOxwopXpuM_pjUhm-Dkg.png" /></figure><p>The hierarchy of the design is clear: focus first on the main content, second the figures, and lastly the UI. A number of little details and design practices work together to make the experience intuitive, dynamic, and powerful. I’ll go over a few features below.</p><h4>Content Cards</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pFbd3Xms9w9hnGEdp7LnbA.jpeg" /></figure><p>Inspired by the <a href="http://www.google.com/design/">Material Design</a> card layout, I sought to utilize these spaces to help govern the content, to organize figures, and to allow for an adaptive, dynamic layout. These cards help communicate the large amounts of information that can seem daunting in other contexts such as PDFs or ebooks (take a look at <a href="http://www.feynmanlectures.caltech.edu/III_17.html#Ch17-S3">this chapter</a> in The Feynman Lectures for a contrasting design). By splitting each section of a chapter into its own card the barrier of being overwhelmed is diminished.</p><h4>Ribbon Tools</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*TuvEVRSjsLZmlTG1erCVgQ.png" /></figure><p>Ribbion tools provide easy access to some of the options that users will want to use most often in the context of reading. These include common equations that are usually found at the front or back of books, font options for making changes to how the context is displayed, and a highlighting tool used for creating notes. When a user would enable the “common equations” a card (similar to a figure card) would move in on the right to be accessible while reading. Tooltips display over each UI item when users hover over them long enough. This way new users can get an idea of what each object does while not annoying more experienced users.</p><h4>Inline Comments</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rPYbQ7-ZVcDHf0SdAcMR5A.jpeg" /></figure><p>A basic forum-like question and answering system (think <a href="https://piazza.com/">Piazza</a>) doesn’t quite translate well over to Physics. Context is often necessary when asking a question and it is often about the textbook. Inline comments try to solve this issue by connecting questions with parts of the textbook. Users can hover over a paragraph and click the ask a question icon —much like how you can do with this article on Medium. Unanswered questions asked by other classmates show up inline as a red question bubble however answered/finished conversations show up as green. The icons are meant to be small and out of the way of the main reading experience. While still being unnoticeable, they cue the reader that there is more information if they wish to indulge into the conversation. In addition to providing this “iTunes Album Art view” to seeing comments there is an overview tab to see all of the conversations going on. This flips the main content card backwards revealing the discussions related to that section. For each question Context sections are provided to help the reader understand what the question is referencing. These Context sections include at least one sentence and are no more than 3–4 lines long. The arrow in the corner of each Context section bring the user back to the other side of the card showing the full context of the question.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyL_j-rsJe86dJs9sSrxiA.jpeg" /></figure><h4>Smart Figures</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pqXMRegvuZs7Qu6ci8izGQ.jpeg" /></figure><p>Smart figures allow for easily viewing diagrams and figures. With textbooks and digital books figures are inline. This makes it difficult to reference back to if a section is long or a later section refers back to an earlier figure. While this might seem small, looking for a diagram takes away from learning and often ruins a flow of consiousness. Smart figures will scroll only if they are no longer needed in a section. As you scroll through the main content corresponding figure cards will scroll in and out as you need them. The little icon in the left makes the card expand out to take up the page to allow closer inspection. Eventually, I would love to see these figures become interactive to allow a greater connection and exportation of the material. Making figures interactive (perhaps with <a href="http://d3js.org/">D3</a>) is a daunting task to do for a whole textbook (let alone a whole catalog) however the payoff is huge as users will become more motivated to learn through interactivity rather than just remembering the motions of problem solving.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-4RTciUK-6gjsERmcZG7A.jpeg" /><figcaption>3 Views of The Ansatz: the Sidebar (Left), the Homepage (Center), and the Book Collection (Right).</figcaption></figure><h3>Conclusion</h3><p>The project currently still has a long way to go however I think these are the right steps towards rethinking how higher education is communicated. Even though I haven’t addressed all my main topics with <em>The Ansatz </em>just yet I hope you see that these tools need to explore how design and interactivity can help provide a deeper, more meaningful way of learning. It needs to be personal, connected, and clear. This project illustrates my approach to problem solving and how I try to come up with solutions that are purposeful. It’s something that is near and dear to me that has been brewing away ever since I first saw <em>bSpace. </em>There is a lot more planned and some more to be worked out. I hope to produce other articles detailing my progress on the other views and to have a fully working prototype. In the mean time…</p><blockquote>Reach For The Sky — <em>Woody, Toy Story</em></blockquote><p><em>I am a physicist, designer, and musician working at the intersection of Physics, Music, and Design. You can find more about me at my </em><a href="http://kevingutowski.com/"><em>Website</em></a><em>. If you have any questions or want to get in touch you can email me at kev@berkeley.edu</em></p><p>Social: <a href="http://www.linkedin.com/in/kevingutowski/">LinkedIn</a>, <a href="https://www.behance.net/Kski">Behance</a>, <a href="http://www.musicianspage.com/musicians/KskiMusic/">MusiciansPage</a>, <a href="https://github.com/KevinGutowski">GitHub</a></p><p><em>I want to thank my </em><a href="http://wdd.io/"><em>WDD</em></a><em> instructors for helping me along the way (sorry I couldn’t present!), my friend Michelle for Design advice, and all my friends &amp; family who let me ramble on about design practices. You all inspire me to push my ideas and dreams further than I can ever imagine.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cf92091a030" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>