ios - Trouble creating a color in swift on Xcode using variables in a different class -


what wrong code? created variables in different class random values rgb color.

import uikit  class graphics: viewcontroller {      class color: uiview     {     override func drawrect(rect: cgrect)     {         let swiftcolor = uicolor(red: 1, green: 165/255, blue: 0, alpha: 1);          let context = uigraphicsgetcurrentcontext()         cgcontextsetlinewidth(context, 5.0)         cgcontextsetstrokecolorwithcolor(context,             uicolor(red: red1, green: green1, blue: blue1, alpha: 1.0))//.bluecolor().cgcolor)         let rectangle = cgrectmake(60,170,200,80)         cgcontextaddrect(context, rectangle)         cgcontextstrokepath(context)         cgcontextsetfillcolorwithcolor(context,             uicolor(red: red, green: green, blue: blue, alpha: 1.0))//.redcolor().cgcolor)             cgcontextfillrect(context, rectangle)     }         /*     // override drawrect: if perform custom drawing.     // empty implementation adversely affects performance during animation.     override func drawrect(rect: cgrect) {         // drawing code     }     */     }  } 

these error messages:

"graphics.type not have member named red"

"extra argument 'green' in call"

  1. create instance of other class contains color variables

    var colors = colorclass() 
  2. call colors instance

    colors.green   

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -