• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Objective-C
  • License
    MIT License
  • Created over 10 years ago
  • Updated almost 10 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically Exporting Assets from Sketch into Xcode.

Automatically Exporting Assets from Sketch into Xcode.

Header

Today, Bohemian Coding released SketchTool. It’s “a command-line app for exporting pages and slices out of .sketch docs.”

Many people use Sketch in their Mac and iOS development workflow. Previously, the process involved making changes in Sketch, exporting them, moving them into Xcode Asset Catalogs, then running. However, with SketchTool, this can all be done automatically.

Screencast

Watch the screencast.

Download the files used in the screencast.

Installing Sketchtool

You can download the latest version of Sketchtool from Bohemian Coding’s website. To install it, run "install.sh".

Alternatively, use the following lines of code pasted into Terminal to do effectively the same thing:

curl http://static-download.s3-website-us-east-1.amazonaws.com/sketchtool/sketchtool-latest.zip > sketchtool-latest.zip;\
unzip sketchtool-latest.zip;\
cd sketchtool/;\
./install.sh;\
cd ../;\
rm -r sketchtool/;\
rm sketchtool-latest.zip;

Setting up your Sketch files

Many people have their project organized differently, but I prefer to have all Sketch documents in a folder at the root of the project’s directory. I usually name it “Graphics Resources”. This is what I’ll be using in the screencast.

Then, use artboards and slices for the assets you want to export. For example, in my app icon Sketch document (AppIcon.sketch), I have an artboard made for each size of the icon. It’s a modified version of the iOS app icon template bundled with Sketch 3.

Build scripts

In Xcode, you can add a new run script build phase. Make sure this new build phase occurs before “Copy Bundle Resources”, which copies in Image.xcassets.

The contents of the script should be like:

sketchtool export artboards "$PROJECT_DIR"/"Graphics Resources/AppIcon.sketch" --output="$PROJECT_DIR"/"$PROJECT_NAME"/Images.xcassets/AppIcon.appiconset --formats="png"

This should be modified and extended for your uses, and I may try to work out a way where this can be done more easily.

More Repositories

1

What-s-New

Easily present the latest changes and features to your users on app updates.
Objective-C
1,156
star
2

Colors

A collection of UIColor categories and helper APIs for picking colors and generating color schemes. Bring life and beauty into your iOS application through dynamic user interfaces.
Objective-C
205
star
3

MTZRadialMenu

A radial menu for iOS, like the one introduced in Messages for iOS 8.
Objective-C
141
star
4

MTZTiltReflectionSlider

UISlider subclass mimicking and improving the tilt controlled slider added to Music.app in iOS 6
Objective-C
84
star
5

NetworkActivityIndicator

Easily work with the network activity indicator in the iOS status bar. UIApplication category and demo app.
Objective-C
54
star
6

Handedness

Determine handedness of a UIPinchGestureRecognizer
Objective-C
40
star
7

Keyboard

I have always had a lot of opinions on software keyboards, so I need to make my own custom keyboard.
Swift
36
star
8

Spring-Animation

A simple iOS app to demonstrate UIView spring animations.
Objective-C
32
star
9

iOS-Passcode

Passcode app for iOS
Objective-C
16
star
10

MTZTextField

Fixing an issue with `UITextField` where the highlighted state of the text field's clear button is always the default blue, and not the tint color of the text field.
Objective-C
15
star
11

Blog.txt

Plaintext to web-based blog.
PHP
14
star
12

MTZSplitViewController

Fixing API of `UISplitViewController`.
Objective-C
12
star
13

Sonar

A Native Mac App for Apple's Bug Reporter
Objective-C
9
star
14

Goodnight

An iOS app that tells you when to wake up or fall asleep based on 90 minute sleep cycles.
Objective-C
7
star
15

replace_icns

Replace application icons from the command line.
Python
4
star
16

PushBackControl

When interacting with a control, it "pushes back" and responds with realtime feedback.
Objective-C
4
star
17

SmartCrop

More intelligently crop photos.
Objective-C
3
star
18

Safari-Passcode

Create a nice Safari extension for the passcode generator tool
3
star
19

Honeycrisp

Honeycrisp is a collection of advanced user interface controls and tools built on top of the iOS SDK.
2
star
20

dotfiles

Shell
2
star
21

Rewritten-APIs

Rewriting the APIs of classes in UIKit (like UIActionSheet and UIAlertView) to make them more sensical and easier to use.
Objective-C
2
star
22

WWDC-2014-Scholarship-Application

My submission for the WWDC 2014 Scholarship. https://developer.apple.com/wwdc/students/
Objective-C
2
star
23

Cloud

A simple, easy-to-use, file management system.
PHP
1
star
24

Computer-or-Fridge

Computer or Fridge?
1
star
25

Instapaper

Read Later Contextual Menu
JavaScript
1
star
26

Proxy-Server

Proxy Server assignment for Network Programming.
C
1
star
27

SwipeToMoveCursor

Objective-C
1
star
28

Icon-Launchers

Mini dummy apps with replacement icons that launch the real app. This isn't practical for anything.
Objective-C
1
star
29

Slide-To-Reveal-Control

Control for Passcodes that reveals a hidden work in a field with a magnifying glass.
Objective-C
1
star