Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
いくつかの定数をグローバルとして宣言する必要があるアプリを作成しています。Obj CI では pch ファイルを使用できますが、Swift で定義する方法がわかりません。例えば
Obj C .pch ファイルで宣言した場合
その後、アプリケーション全体で機能します。
あなたがする必要があるのは、Constants.swiftファイル(またはそれに名前を付けたいもの)を作成し、必要な定数をそれに追加することだけです。
Constants.swift
let myVariable = "Some Value" let myOtherVariable = "Something Else"
その後、アプリケーション全体で使用できるようになります。