Is it ok to place most logic and models in the appDelegate?

后端 未结 3 417
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 09:26

For most of my apps, I have placed all the logic in classes, that each ViewController would get a reference too the class, or create/release the object itself.

I j

3条回答
  •  鱼传尺愫
    2020-12-03 09:54

    Technically you could do it. In terms of programming practice, don't. Once you put a lot of things in the appDelegate, it will become very messy. My advice would be leave it alone.

    You don't need to put anything in appDelegate except global variables. And if you do need it sometimes, my suggestion would be use something else like singleton pattern. Generally speaking, global variables are not good practice.

    Hope this helps.

提交回复
热议问题