there codes writting.
import uikit @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate, xpageviewcontrollerdatasource { var window: uiwindow? func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. self.window = uiwindow(frame: uiscreen.mainscreen().bounds) let pageveiwcontroller = xpageviewcontroller() pageveiwcontroller.datasource = self self.window?.rootviewcontroller = uinavigationcontroller(rootviewcontroller: pageveiwcontroller) self.window?.makekeyandvisible() return true } func xpagenumberofcontrollers() -> nsinteger { return 5 } func xpagecontrollerstitle(index: nsinteger) -> string { return "viewcontroller"+"title"+string(index) } func xpagewillshowcontroller(index: nsinteger) -> uiviewcontroller { let vc = viewcontroller() return vc } }
i writing pure coding programme without mainstoryboard in xcode, appdelegate.swift, try implement protocol xpageviewcontroller.swift, there 3 functions in protocol have written in appdelegate. , have declared in xpageviewcontroller.swift
var datasource:xpageviewcontrollerdatasource! { didset{ self.numberofcontrollers = self.datasource.xpagenumberofcontroller() self.addviewtoself() }
which using in appdelegate
pageveiwcontroller.datasource = self
but still error occur there, shows"type 'appdelegate' not conform protocol 'xpageviewcontrollerdatasource'"
i run out solutions :d have ideas can me solve this?
can show xpageviewcontrollerdatasource
protocol comprises of?
command+click in xcode view actual protocol.
either way, when view protocol should show requirements protocol are.
Comments
Post a Comment