What's the best practice for naming Swift files that add extensions to existing objects?

后端 未结 7 742
面向向阳花
面向向阳花 2021-01-29 20:43

It\'s possible to add extensions to existing Swift object types using extensions, as described in the language specification.

As a result, it\'s possible to create exten

7条回答
  •  心在旅途
    2021-01-29 21:34

    There is no Swift convention. Keep it simple:

    StringExtensions.swift
    

    I create one file for each class I'm extending. If you use a single file for all extensions, it will quickly become a jungle.

提交回复
热议问题