Loading...

Using Swift View

XD, PSD, AI and INDD layers to Swift with clean and clear code becomes simple. Translate your XD, PSD, AI and INDD layers to Swift with advanced support for text, images and shapes.

Example Image Element

1
2
3
4
5
6
7
//you must import your image
let button_copy_view = UIImageView(frame:CGRectMake(446, 240, 310, 166))
let button_copy = UIImage(named:"button_copy.png")
 
button_copy_view.image = button_copy
 
self.view.addSubview(button_copy_view)

Example Text Element

1
2
3
4
5
6
7
8
9
10
11
12
13
let text:UITextField = UITextField(frame:CGRectMake(132, 501, 227, 90))
let text_font:UIFont = UIFont(name:"ArialMT", size:68)
let text_str = "TEXT"
let text_textColor:UIColor = UIColor(red:255.0, green:255.0, blue:255.0, alpha:1)
let text_textStr = NSAttributedString(string:text_str)
 
text_textStr.addAttribute(NSKernAttributeName, value:2.0)
text_textStr.addAttribute(NSFontAttributeName, value:text_font)
text_textStr.addAttribute(NSForegroundColorAttributeName, value:text_textColor)
 
text.attributedText = text_textStr
 
self.view.addSubview(text)

Example Shape Element

1
2
3
4
5
6
7
8
9
10
11
12
//Its better to sub-class this
override func drawRect(rect:CGRect){
 
    let button_bg_context = UIGraphicsGetCurrentContext()
    let button_bg_rectangle = CGRectMake(72, 449, 310, 159)
 
    CGContextAddRect(button_bg_context, button_bg_rectangle)
    CGContextSetFillColorWithColor(button_bg_context, UIColor(red:206.0, green:54.0, blue:54.0).CGColor)
    CGContextFillRect(button_bg_context, button_bg_rectangle)
 
    self.view.layer.cornerRadius = 30
}

Customize the Swift View to include additional information with the XD, PSD, AI and INDD layer such as effects, advanced text rendering and more.

Example Layer Effects

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
let text:UITextField = UITextField(frame:CGRectMake(132, 501, 227, 90))
let text_font:UIFont = UIFont(name:"ArialMT", size:68)
let text_str = "TEXT"
let text_textColor:UIColor = UIColor(red:206.0, green:54.0, blue:54.0, alpha:1)
let text_textStr = NSAttributedString(string:text_str)
let text_shadow:NSShadow = NSShadow()
 
text_shadow.shadowColor = UIColor(red:0 green:0, blue:0).CGColor
text_shadow.shadowOffset = CGSizeMake(-4f, 3f)
text_shadow.shadowOpacity = 0.8f
text_shadow.shadowRadius  = 2.5f
 
text_textStr.addAttribute(NSKernAttributeName, value:2.0)
text_textStr.addAttribute(NSFontAttributeName, value:text_font)
text_textStr.addAttribute(NSForegroundColorAttributeName, value:text_textColor)
text_textStr.addAttribute(NSShadowAttributeName, value:text_shadow)
 
text.attributedText = text_textStr
 
self.view.addSubview(text)

Example Inline Content

1
2
3
4
5
6
7
8
9
10
11
12
let button_bg:UIView = UIView(frame:CGRectMake(72, 449, 310, 159))
 
button_bg.cornerRadius = 30
 
button_bg.shadowColor = UIColor(red:206.0, green:54.0, blue:54.0).CGColor
button_bg.shadowOffset = CGSizeZero
button_bg.shadowOpacity = 0.8f
button_bg.shadowRadius  = 12.5f
 
button_bg.backgroundColor = UIColor(red:206.0, green:54.0, blue:54.0).CGColor
 
self.view.addSubview(button_bg)

LOGIN NOW: Get instant access to our free Online Training - click here.

02. Using The Plugin

03. Layer Support

04. Basic Exports

05. Layer Tags

06. Optimization Tips

07. Complete Exports

Help Us Improve


We aim to keep our content relevant with useful information, examples, samples and links. Tell us what you think!

I found the content:

Helpful
Confusing
Outdated
Broken Links
Bad Spelling
Too Short
Too Long

This page needs:

Nothing
Better Content
Links
Examples
Videos

Free Download


One Pager Website

A clean professional single page website design.

Connect With Us

BLACKOUT SALE | 80% Off - Shop Now - Limited Time Only