Is it acceptable to create multiple classes in one .swift file, or should I create a separate .swift file for each class?

前端 未结 3 1293
臣服心动
臣服心动 2021-01-17 07:34

Is it considered poor technique to create multiple classes in one swift file, or is it best to create a separate swift file for each class?

3条回答
  •  花落未央
    2021-01-17 08:06

    Short answer: it depends.

    Long answer:
    If you have small short classes that are strongly binded together, it's correct to put the in the same file.
    If you have long, unrelated classes, then you better put them in different files.

提交回复
热议问题