App Extension
以下引用
App Extensionには、基盤となるアプリケーションの機能や能力を拡大する働きがあります。ユーザは、他のアプリケーションまたはシステムとやり取りしながらでも、その機能や能力を活用できます。
つまりはアプリの拡張(まんまw)
Share Extension
 環境構築
環境構築
-> 「Activate」を選択
Targetが追加されると 
ShareViewController.swiftが追加されている
swift
import UIKit
import Social
class ShareViewController: SLComposeServiceViewController {
    override func isContentValid() -> Bool {
        // Do validation of contentText and/or NSExtensionContext attachments here
        return true
    }
    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 []
    }
}
App Groupの設定
Info.plistの編集
扱えるデータ型を定義する
例) テキストを利用する、画像3枚、WebページのURLを1つまでとする場合
例) テキストを利用する、画像3枚、WebページのURLを1つまでとする場合
  <key>NSExtensionAttributes</key>
  <dict>
   <key>NSExtensionActivationRule</key>
   <dict>
    <key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
    <integer>1</integer>
    <key>NSExtensionActivationSupportsImageWithMaxCount</key>
    <integer>3</integer>
    <key>NSExtensionActivationSupportsText</key>
    <true/>
   </dict>
  </dict>
この時点で一回実行させてみる
追加したTarget(Share Extension実装用)を選択して実行すると
↑のようなダイアログが表示され、どのアプリケーションから Share Extension を動かすか選択できる
↑のようなダイアログが表示され、どのアプリケーションから Share Extension を動かすか選択できる
 実装
 実装
ShareViewController.swift側の実装を後は好きなようにやる既にあるメソッドの意味
| メソッド | 何をするメソッドか? | 
|---|---|
| isContentValid | バリデーション(Postを押せる状態か?) | 
| didSelectPost | Postが押された後の処理 | 
| configurationItems | 追加項目のリスト管理 | 








 
pusulabet
返信削除sex hattı
https://izmirkizlari.com
rulet siteleri
rexbet
5Eİ