LoginSignup
7
5

More than 3 years have passed since last update.

SVProgressHUDをXcode11で使う

Last updated at Posted at 2020-06-22

メモ

SVProgressHUDをXcode11で実装しようとしたら、そのままだと動かないみたい。

下準備

ターミナルを開いてcdコマンドでプロジェクトディレクトリに移動後、pod initを実行(podfileの生成)。
生成されたpodfileをテキストエディットとかで編集。
pod 'SVProgressHUD'を追加して、pod installpod updateを実行。
生成された.xcworkspaceファイルを開く。

追加するコード

AppDelegate.swiftに次のコードを追加。

AppDelegate.swift
    var window: UIWindow?

SceneDelegate.swiftscene(_:willConnectTo:options)メソッド内に次のコードを追加。

SceneDelegate.swift
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    appDelegate.window = self.window

サンプルプロジェクト

サンプルプロジェクトはこちら
https://github.com/rea-sna/SVProgressHUD_Sample

動作画面

わかりやすくするために3秒後にHUDが消えるようにしています。
ezgif.com-video-to-gif (6).gif

参考記事

7
5
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
7
5