Kodeco Forums

How To Make A Simple Drawing App with UIKit and Swift

Learn how to make your own drawing app, including different colors and brushes, using UIKit and Core Graphics in this tutorial!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1934-how-to-make-a-simple-drawing-app-with-uikit-and-swift

Please tell is it really to do the drawing app in swift that could use textures for brush, marker, pencil.
I want that it has full functional drawing app . Is it real if true - tell me please were i can find the information

Great tutorial. This was informative and really showed how you can do something cool - succinctly - by learning to use the frameworks. Fun, too!

Hi. Thanks for the tutorial. If I have multiple tempImageViews (1,2,3) in the mainIamgeView which is scrollable. Then when I hit the share button can I export to the photos app the photos of all tempimageViews?

How would I go about just drawing in a smaller UIView, for a signature box, for example?

You can use UIImageWriteToSavedPhotosAlbum to save an image to the camera roll, i’m not sure but i guess you have to call this method for each tempImageView.

You could write your own subclass of UIView and handle all the touchesBegan/Moved/Ended stuff in this subclass instead of the ViewController.

Jean-Pierre,

Loved the tutorial. I have a real image (background image) instead of the empty mainImageView. Now when I start drawing (tempImageView β†’ mainImageView) the mainImageView image becomes pixelated. Any ideas?

Oh never mind, I did a work around - Instead of superimposing in the touches ended, I chose to superimpose when the user touches the share button. thanks.

Hi, I wanna know if I use alpha=0.5 to make the drawing translucent, when 2 drawing has parts that overlap, how can I make the color not to overlap?

Jean-Pierre,

I’d like to store the tempImage to file system, and save the path to core data. And then of course retrieve the tempImage. I tried to follow all sorts of tutorials but can’t figure it out. Could you please help me with this. Thanks so much!

Hi. thanks for the tutorial. I’ve written code under this tutorial.
Now i want to add two buttons undo/redo. I found the solution on google and posts on stackoverflow (ios - Implementing redo alongside undo with UndoManager in drawing application Swift 3 - Stack Overflow) , but not yet.
Thank you very much for your help!

When will this be updated for Swift 3.0?

Hello, I updated the code for Swift 3.0 here: GitHub - dragosholban/DrawPad: Updated code for DrawPad tutorial published on raywenderlich.com

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]