Upgrade to Pro — share decks privately, control downloads, hide ads and more …

札幌iPhone開発懇談会2020年11月資料

notoroid
November 23, 2020

 札幌iPhone開発懇談会2020年11月資料

iOS14で追加されたWidget/ウィジット設定ダイアログについての発表資料。

・ウィジット略史
・16ステップでできるウィジット設定ダイアログ

notoroid

November 23, 2020
Tweet

More Decks by notoroid

Other Decks in Programming

Transcript

  1. ॆిใࠂ͞Μ #BUUFSFDFJWFS w όοςϦʔϞχλʔ ϢʔςΟϦςΟʔ  w ࠷େ୆ ࣮ػ ϦϞʔτ୆

     w ख࣋ͪͷJ1IPOF͔Βଞʹ͍࣋ͬͯΔ J1IPOF J1BEͳͲͷػثͷόοςϦʔঢ়ଶ֬ ೝՄೳ w ࣗ୐ʹ͋ΔJ1IPOFͷόοςϦʔঢ়ଶ֬ೝՄ ೳ
  2. ॆిใࠂ͞Μ #BUUFSFDFJWFS w "QQMF8BUDIରԠ w $PNQMJDBUJPOTରԠ w ॆి׬ྃ௨஌ w ॆి׬ྃΛ఻͑ͯ͘ΕΔ௨஌Λ௥Ճ

    w ҎԼʹࢦఆ͢Δ͜ͱͰόοςϦʔ ΛέΞ͢Δ͜ͱ͕Մೳ w Կ͔ͱߴ͍J1IPOFΛ௕࣋ͪͤ͞Δͷʹ༗ ༻
  3. %BTICPBSE΢Οδοτͷߏ੒ w εΩϡϞʔϑΟζϜ w 8FC༝དྷͷٕज़ w 9.- w &$."4DSJQUY w

    σʔλιʔε w γεςϜʹ௚઀ΞΫηεՄೳ w ωοτϫʔΫ΁ͷΞΫηε
  4. enum DisplayTypeDefinition: String { case slot234 = "Slot2-3-4" case slot1

    = "Slot1" case slot2 = "Slot2" case slot3 = "Slot3" case slot4 = "Slot4" func identifier() -> String { self.rawValue } func displayName() -> String { switch self { case .slot234: return "Stack(Slot2,3,4)" case .slot1: return "Slot1" case .slot2: return "Slot2" case .slot3: return "Slot3" case .slot4: return "Slot4" } } }
  5. class IntentHandler: INExtension, ConfigurationIntentHandling { func provideDisplayTypeOptionsCollection(for intent: ConfigurationIntent, with

    completion: @escaping (INObjectCollection<DisplayType>?, Error?) -> Void) { let displayTypeDefinitions: [DisplayTypeDefinition] = [ .slot234, .slot1, .slot2, .slot3, .slot4 ] let displayType = displayTypeDefinitions.map { (displayTypeDefinition) -> DisplayType in DisplayType(identifier: displayTypeDefinition.identifier(), display: displayTypeDefinition.displayName()) } completion(INObjectCollection(items: displayType), nil) } func defaultDisplayType(for intent: ConfigurationIntent) -> DisplayType? { return DisplayType(identifier: DisplayTypeDefinition.slot234.identifier(), display: DisplayTypeDefinition.slot234.displayName()) } }
  6. struct GraphEntryView : View { var entry: Provider.Entry func displayType()

    -> DisplayTypeDefinition { let defaultValue = DisplayTypeDefinition.slot234 let rawValue = entry.configuration.displayType?.identifier ?? defaultValue.identifier() return DisplayTypeDefinition(rawValue: rawValue) ?? defaultValue } var body: some View { switch self.displayType() { case .slot234: return Text("ελοΫදࣔ") default: return Text("ͦͷଞ") } } }