[TIL] 2021.03.07


👩🏻‍💻 今日の勉強内容


Share Extension( コメントサイト )

  • File->New->Target
  • をクリックします
  • iOSタブでShareExtensionをクリックして
  • を作成
  • Schemeをターゲットバージョン
  • の作成に変換
  • は、共有するアプリケーションの設定を開始します(Safariに簡単に設定できます).

  • 5.ターゲットファイルでターゲット名ViewControllerをクリック
  • isContentValid():テキストを入力するたびに呼び出される関数
  • didSelectPost():Postボタンを押すと呼び出される関数
  • didSelectCancel():Cancelボタンを押すと呼び出される関数
  • 構成Items():構成ItemをComponentビューに表示する必要がある場合は、
  • を実施する.
    import UIKit
    import Social
    
    class ShareViewController: SLComposeServiceViewController {
    
        // Text가 입력될 때마다 호출
        override func isContentValid() -> Bool {
            // contentText : TextView의 Text
            return self.contentText.isEmpty == false
        }
    
        override func didSelectPost() {
            // This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
        
            // Inform the host that we're done, so it un-blocks its UI. Note: Alternatively you could call super's -didSelectPost, which will similarly complete the extension context.
            self.extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
        }
    
        override func configurationItems() -> [Any]! {
            // To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
            return []
        }
    
    }

    ✍🏻 今日は


    Extensionをカスタマイズしたいのですが、どうしてまたエラーが発生しましたか?!?無職の人も日曜日に休みたいので、間違いは明日解決しましょう.😓 明日から新しいアプリを作るのですが、忙しい~来週から本当に頑張ります🤪