LoginSignup
4
4

More than 5 years have passed since last update.

Swiftでの@UIApplicationMainとクラス継承

Last updated at Posted at 2014-09-27

6.1で修正されたようです。
継承側でUIApplicationDelegateを書かなくてもエラーにならなくなっているようです

AppDelegateようの基本クラスを自作フレームワークで
public class HogeAppDelegate : UIResponder , UIApplicationDelegate
{
}
のように作っておいて

@ApplicationMain
class AppDelegate : HogeAppDelegate
{
}
のように使おうとすると、コンパイラの解釈の問題か
@ApplicationMainにはUIApplicationDelegateプロトコルが必要だというエラーになってしまう
ここは、気持ち悪くても

@ApplicationMain
class AppDelegate : HogeAppDelegate , UIApplicationDelegate
{
}

のように両方にUIApplicationDelegateプロトコルを指定して回避する

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4