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

自己管理の夢とScreen Time API / iOSDC Japan 2021 - Screen Time API

A2cd163fd3cfca5204b0d8f0c17eea29?s=47 Yuji Fujisaka
September 19, 2021

自己管理の夢とScreen Time API / iOSDC Japan 2021 - Screen Time API

A2cd163fd3cfca5204b0d8f0c17eea29?s=128

Yuji Fujisaka

September 19, 2021
Tweet

Transcript

  1. ZVKJGJ04%$+BQBO ࣗݾ؅ཧͷເͱ 4DSFFO5JNF"1*

  2. ͸͡Ίʹ ର৅ w ೔ʑͷ࣌ؒ؅ཧɾλεΫ؅ཧʹؔ৺͕͋Δਓ w 4DSFFO5JNFػೳʹڵຯ͕͋Δਓ w 4DSFFO5JNF"1*ͰԿ͕Ͱ͖Δͷ͔஌Γ͍ͨਓ

  3. !ೣɼྉཧ "$PPLQBE*OD ΫοΫύουJ04ΞϓϦ ‣ 4XJGU6*ΛऔΓೖΕͨ ങ͍෺ػೳͷ։ൃ ࣗݾ঺հ IUUQTUFDIMJGFDPPLQBEDPNFOUSZLBJNPOPTXJGUVJ ౻ࡔ༞࢙ʢ:VKJ'VKJTBLBʣ !ZVKJG@

  4. ࣗݾ؅ཧʁ

  5. ࣗ਎ͷ؀ڥͷมԽ w άϧʔϓϦʔμʔʹͳͬͯ ‣ ࣮૷ʗϚωδϝϯτʗকདྷతͳ ల๬ʗٕज़తෛ࠴ͷฦࡁʗʜʜ w ϦϞʔτϫʔΫʹͳͬͯ ‣ ௨ۈ࣌ؒͷΧοτʗੜ׆ͱۀ຿

    ͷ੾Γସ͑ʗӡಈෆ଍ʗʜʜ എܠ
  6. ࣌ؒͷ࢖͍ํ w ΍Γ͍ͨ͜ͱ͸୔ࢁ͋Δʜʜʂ ‣ ԿΛ༏ઌ࣌ؒ͠ΛͲ͏࢖͏͔ w ʮ͕࣌ؒͳ͍ʂʯͱࢥ͏ҰํͰɺ ແҙࣝʹ࣌ؒΛඅ΍͢͜ͱ΋͋Δ ‣ গ͠ٳܜ͢Δͭ΋Γ͕ɺεϚϗ

    Λͣͬͱʜʜ എܠ Ξχϝ ݸਓ։ൃ ೣͱ༡Ϳ ྉཧ ಡॻ ήʔϜ ӡಈ
  7. ࣌ؒΛ͏·͘࢖͑ΔΑ͏ʹͳΓ͍ͨʜʜ

  8. ࣌ؒɾλεΫ؅ཧ ϙϞυʔϩ 5JNF5JNFS (FUUJOH5IJOHT%POF (5% 0NOJ'PDVT λεΫγϡʔτ࢓ࣄज़ 5BTL$IVUF$MPVE λΠϜτϥοΩϯάπʔϧ 5ZNF

    Ψϯτνϟʔτ όʔϯμ΢ϯνϟʔτ ϓϥϯχϯάϙʔΧʔ εϓϦϯτϓϥϯχϯά 5PHHM 8BLB5JNF (PPHMF,FFQ 5SFMMP "TBOB 1JWPUBM5SBDLFS 5SBDLJOH5JNF 5JNJOH Ϛχϟʔφͷ๏ଇ 5PEPJTU ΞΠϏʔɾϦʔɾϝιου 5IJOHT 0NOJ1MBO λεΫϖσΟΞ
  9. ྫɿ5BTL$IVUF$MPVE w ʮλεΫγϡʔτ࣌ؒज़ʯ ʹଇͬͨλεΫϦετܕͷπʔϧ ᶃ ʮຊ೔̍೔෼ͷ࢓ࣄʯΛ̍γʔτͰ؅ཧ͢Δ ᶄ ʮ͜Ε͔Β΍Δ࢓ࣄͷϦετʯͱ ʮ͜͜·Ͱʹ΍ͬͨ࢓ࣄͷϦετʯΛҰݩ؅ཧ͢Δ ᶅ

    ʮ̍෼Ҏ্࣌ؒͷ͔͔Δ͜ͱʯ͸͢΂ͯ؅ཧ͢Δ ᶆ ͢΂ͯͷ࢓ࣄͷʮݟੵ΋Γ࣌ؒʯΛग़͓ͯ͘͠ ᶇ ʮຊ೔̍೔෼ͷ࢓ࣄʯ͕͢΂ͯऴΘͬͨΒԿ࣌ʹͳΔ ͔ͷ༧ଌΛࣗಈࢉग़͢Δ͜ͱͰɺৗʹ࢓ࣄͷऴΘΔ࣌ ؒʢ·ͨ͸ब৸࣌ࠁʣΛϦΞϧλΠϜʹ೺Ѳ͢Δ ࣌ؒɾλεΫ؅ཧπʔϧ IUUQTCMPHUBTLDIVUFDMPVEXIBUJTUBTLDIVUF
  10. w ʮ࣌ؒͷ࢖͍ํʯͷݱঢ়೺Ѳ͕Ͱ͖Δ ‣ ࢖్ෆ໌͕࣌ؒݟ͑ͯ͘Δ ‣ ༧ଌͱ࣮੷ͷζϨ͕ݟ͑ͯ͘Δ ˣ w ݟੵΓΛਫ਼៛Խ͠΍͍͢ ‣

    ʮ͜ΕͳΒͰ͖ͦ͏ʂʯͱ ֬৴Λ࣋ͯΔ༧ఆʹͰ͖Δ ‣ ࣗ෼ΛίϯτϩʔϧͰ͖͍ͯΔ ײ֮ʹͳΔʢ҆ఆͯ͠ḿΔʣ ࣌ؒɾλεΫ؅ཧπʔϧ IUUQTCMPHUBTLDIVUFDMPVEXIZJTOUUBTLDIVUFDMPVEDSBNQFE ࣗ෼͕ಛʹײͨ͡Ձ஋
  11. ໨ࢦ͍ͨ͠ํ޲͸ݟ͕͑ͨʜʜ w ͳ͔ͳ͔ܧଓͰ͖ͳ͍ w ଞπʔϧͱೋॏ؅ཧʹͳͬͯ ໘౗ʹͳΔʗݟͳ͘ͳΔ w ࡞ۀʹ຅಄͍ͯͯ͠ɺ։࢝ɾऴྃ ͷه࿥Λ๨ΕΔ w

    ରԠͰ่͖ͣյ͠͸͡ΊΔ ಥવͷׂΓࠐΈɺ୤ઢɺʜʜ ࣌ؒɾλεΫ؅ཧπʔϧ
  12. ࣗ෼ʹ߹͏࠷ߴͷղܾࡦ͕΄͍͠ʜʜ

  13. ࣌ؒΛ͏·͘࢖͏ͨΊʹ ɾ࢖్ෆ໌࣌ؒΛ೺Ѳ͍ͨ͠ ɾ༧ଌͱݱ࣮ͷζϨΛೝ͍ࣝͨ͠

  14. ͓ۚΛ͏·͘࢖͏ͨΊʹ ɾ࢖్ෆ໌ۚΛ೺Ѳ͍ͨ͠ ɾ༧ଌͱݱ࣮ͷζϨΛೝ͍ࣝͨ͠

  15. ͏·͍͍ͬͯ͘Δଞͷࣄྫ͸ʁ ྫɿՈܭ฽ΞϓϦͷޱ࠲࿈ܞ w ΫϨδοτΧʔυ΍ۜߦͷ໌ࡉ ͳͲ͕ࣗಈͰه࿥ɾ෼ྨ͞ΕΔ ࢴ΍දܭࢉͰؤுΔͷ͸ଓ͔ͳ͍͕ɺ ࣗಈͰେମ࡞ΒΕΔͳΒଓ͚ΒΕΔ ܧଓ͢ΔͨΊʹ͸

  16. 4DSFFO5JNF

  17. 4DSFFO5JNFͱ͸ʁ

  18. ֓ཁ w ೥ɺJ04Ͱొ৔ w ΞϓϦ΍8FCαΠτ͝ͱʹ Ͳͷ͘Β͍࣌ؒΛඅ΍ͨ͠ͷ͔ ·ͱΊͨϨϙʔτͰ֬ೝͰ͖Δ w ࢖༻࣌ؒͷ੍ݶΛઃ͚ΒΕΔ 4DSFFO5JNF

    IUUQTTVQQPSUBQQMFDPNKBKQ)5
  19. ֓ཁ w ೥ɺJ04Ͱొ৔ w ΞϓϦ΍8FCαΠτ͝ͱʹ Ͳͷ͘Β͍࣌ؒΛඅ΍ͨ͠ͷ͔ ·ͱΊͨϨϙʔτͰ֬ೝͰ͖Δ w ࢖༻࣌ؒͷ੍ݶΛઃ͚ΒΕΔ 4DSFFO5JNF

    IUUQTTVQQPSUBQQMFDPNKBKQ)5
  20. ͦͷଞͷػೳ w ಉҰ"QQMF*%ͷσόΠεͳΒ NBD04ͱJ04ʹ·͕ͨͬͨ ࢖༻ঢ়گ΋֬ೝͰ͖Δ w ௨஌ͷճ਺ɺ্࣋ͪ͛ճ਺ɺ ্࣋ͪ͛ͯ࠷ॳʹ࢖༻ͨ͠ "QQ΋֬ೝͰ͖Δ 4DSFFO5JNF

  21. ͦͷଞͷػೳ w ಉҰ"QQMF*%ͷσόΠεͳΒ NBD04ͱJ04ʹ·͕ͨͬͨ ࢖༻ঢ়گ΋֬ೝͰ͖Δ w ௨஌ͷճ਺ɺ্࣋ͪ͛ճ਺ɺ ্࣋ͪ͛ͯ࠷ॳʹ࢖༻ͨ͠ "QQ΋֬ೝͰ͖Δ 4DSFFO5JNF

  22. ݸਓతͳܦݧஊ w ར༻੍ݶΛઃఆͯ͠΋ʜʜ w ʮԆ௕ʯΛԿ౓΋ͯ͠͠·͏ w ઐ༻ύείʔυΛઃఆͯ͠΋ ͳΊΒ͔ʹೖྗͯ͠Ԇ௕ʜʜ 4DSFFO5JNF

  23. ૉ੖Β͍͠఺ w ໘౗ͳه࿥ૢ࡞͸ཁΒͳ͍ ‣ ͨͩ࢖͍ͬͯΔ͚ͩͰ0, w ԿʹͲͷ͘Β͍࣌ؒΛ࢖͔ͬͨ ٬؍తͳ਺஋ͰೝࣝͰ͖Δ 4DSFFO5JNF

  24. Կͱ͔׆༻Ͱ͖ͳ͍͔#

  25. 88%$Ͱ l.FFUUIF4DSFFO5JNF"1*z$

  26. 4DSFFO5JNF"1*ͱ͸ʁ

  27. ֓ཁ w ೥ɺJ04Ͱొ৔༧ఆ ‣ 4XJGU4XJGU6* w ͭͷ'SBNFXPSLͰߏ੒͞ΕΔ ‣ %FWJDF"DUJWJUZ ‣

    .BOBHFE4FUUJOHT ‣ 'BNJMZ$POUSPMT 4DSFFO5JNF"1* IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
  28. 4DSFFO5JNF"1* ManagedSettings DeviceActivity FamilyControls อޢऀΞΧ΢ϯτʹΑΔঝೝ ϓϥΠόγʔͷอޢ ར༻੍ݶͷ੍ޚ ࢖༻ঢ়گͷ؂ࢹ ΞϓϦىಈͤͣίʔυ࣮ߦ ΞϓϦ͔Β੍ݶͷઃఆɾղআ

    IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO.BOBHFE4FUUJOHT IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO%FWJDF"DUJWJUZ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO'BNJMZ$POUSPMT ͭͷ'SBNFXPSL
  29. 4DSFFO5JNF"1* ͭͷ'SBNFXPSL ManagedSettings DeviceActivity FamilyControls อޢऀΞΧ΢ϯτʹΑΔঝೝ ϓϥΠόγʔͷอޢ ར༻੍ݶͷ੍ޚ ࢖༻ঢ়گͷ؂ࢹ ΞϓϦىಈͤͣίʔυ࣮ߦ

    ΞϓϦ͔Β੍ݶͷઃఆɾղআ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO.BOBHFE4FUUJOHT IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO%FWJDF"DUJWJUZ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO'BNJMZ$POUSPMT
  30. ŠŠ"1*ŠŠ 4DSFFO5JNF"1* w ैདྷɿଞΞϓϦ΍8FCͷ࢖༻ঢ়گΛ ɹɹɹ։ൃऀ͕ѻ͏͜ͱ͸Ͱ͖ͳ͍ ɹɹɹˣ w ࠓճɿϓϥΠόγʔΛอޢͭͭ͠ ɹɹɹΞϓϦ͔Β؂ࢹͰ͖ΔΑ͏ʹͳΔ% %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹ

  31. w %FWJDF"DUJWJUZ/BNF w %FWJDF"DUJWJUZ&WFOU w %FWJDF"DUJWJUZ4DIFEVMF 4DSFFO5JNF"1* ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ w %FWJDF"DUJWJUZ$FOUFS

    w %FWJDF"DUJWJUZ.POJUPS ؂ࢹର৅ͷఆٛ ؂ࢹʹؔ͢Δ੍ޚ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZ %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹ
  32. w %FWJDF"DUJWJUZ/BNF w %FWJDF"DUJWJUZ&WFOU w %FWJDF"DUJWJUZ4DIFEVMF 4DSFFO5JNF"1* %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZ ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ

    w %FWJDF"DUJWJUZ$FOUFS w %FWJDF"DUJWJUZ.POJUPS ߦಈ ࣌ؒଳ ؂ࢹର৅ͷఆٛ ؂ࢹʹؔ͢Δ੍ޚ
  33. w ཁૉ ‣ ର৅ΞϓϦ΍8FCυϝΠϯɼ ΧςΰϦͷτʔΫϯ ‣ ࢖༻࣌ؒͷᮢ஋ 4DSFFO5JNF"1* %FWJDF"DUJWJUZ&WFOUɿର৅ߦಈͷఆٛ public

    struct DeviceActivityEvent { public init( applications: Set<ApplicationToken> = [], categories: Set<ActivityCategoryToken> = [], webDomains: Set<WebDomainToken> = [], threshold: DateComponents ) } IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZEFWJDFBDUJWJUZFWFOU ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ import DeviceActivity // ྫɿʮSNSʯΧςΰϦͰܭ30෼අ΍ͨ͜͠ͱͷఆٛ let snsEvent = DeviceActivityEvent( categories: [ (SNS ΧςΰϦͷ token) ], threshold: DateComponents(minute: 30) )
  34. w ཁૉ ‣ ։࢝࣌ࠁ ‣ ऴྃ࣌ࠁ ‣ ܁Γฦ͠ͷ༗ແ ‣ ࣄલ༧ࠂ࣌ؒ

    4DSFFO5JNF"1* %FWJDF"DUJWJUZ4DIFEVMFɿର৅࣌ؒଳͷఆٛ public struct DeviceActivitySchedule { public init( intervalStart: DateComponents, intervalEnd: DateComponents, repeats: Bool, warningTime: DateComponents? = nil ) } IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZEFWJDFBDUJWJUZTDIFEVMF ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ import DeviceActivity // ྫɿຖ೔ͷ໷10࣌ʙே5࣌ͱ͍͏࣌ؒଳͷఆٛ let night = DeviceActivitySchedule( intervalStart: DateComponents(hour: 22, minute: 0), intervalEnd: DateComponents(hour: 5, minute: 0), repeats: true, warningTime: nil )
  35. w %FWJDF"DUJWJUZ/BNF w %FWJDF"DUJWJUZ&WFOU w %FWJDF"DUJWJUZ4DIFEVMF 4DSFFO5JNF"1* %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹ ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ w

    %FWJDF"DUJWJUZ$FOUFS w %FWJDF"DUJWJUZ.POJUPS & ؂ࢹର৅ͷఆٛ ؂ࢹʹؔ͢Δ੍ޚ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZ
  36. 4DSFFO5JNF"1* %FWJDF"DUJWJUZ$FOUFSɿର৅Λ؂ࢹ͢Δ let allDays = DeviceActivitySchedule( intervalStart: DateComponents(hour: 0, minute:

    0), intervalEnd: DateComponents(hour: 23, minute: 59), repeats: true ) let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [ .encouraged: DeviceActivityEvent( applications: [ਪ঑͍ͨ͠AppͷτʔΫϯ], threshold: DateComponents(minute: 15) ) ] ᶃର৅Λఆٛ ɾຖ೔ʢʙʣ ɾਪ঑͍ͨ͠ΞϓϦʢྫɿֶशܥʣ ɹΛ෼࢖ͬͨͱ͖ ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZEFWJDFBDUJWJUZDFOUFS
  37. 4DSFFO5JNF"1* %FWJDF"DUJWJUZ$FOUFSɿର৅Λ؂ࢹ͢Δ let allDays = DeviceActivitySchedule( intervalStart: DateComponents(hour: 0, minute:

    0), intervalEnd: DateComponents(hour: 23, minute: 59), repeats: true ) let events: [DeviceActivityEvent.Name: DeviceActivityEvent] = [ .encouraged: DeviceActivityEvent( applications: [ਪ঑͍ͨ͠AppͷτʔΫϯ], threshold: DateComponents(minute: 15) ) ] let center = DeviceActivityCenter() try? center.startMonitoring(.example, during: allDays, events: events) ᶄ؂ࢹ։࢝ ᶃର৅Λఆٛ ɾຖ೔ʢʙʣ ɾਪ঑͍ͨ͠ΞϓϦʢྫɿֶशܥʣ ɹΛ෼࢖ͬͨͱ͖ ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZEFWJDFBDUJWJUZDFOUFS
  38. w %FWJDF"DUJWJUZ/BNF w %FWJDF"DUJWJUZ&WFOU w %FWJDF"DUJWJUZ4DIFEVMF 4DSFFO5JNF"1* %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹ ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ w

    %FWJDF"DUJWJUZ$FOUFS w %FWJDF"DUJWJUZ.POJUPS & ؂ࢹର৅ͷఆٛ ؂ࢹʹؔ͢Δ੍ޚ "QQ&YUFOTJPOͰ Πϕϯτൃੜ࣌ʹίʔυ࣮ߦ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZ
  39. w ೥ɺJ04Ͱొ৔ w ଞΞϓϦ΍γεςϜͱ࿈ܞͰ͖Δ ػೳ֦ுͷ࢓૊Έ w ༻్͝ͱʹ&YUFOTJPO͕͋Δ ิ଍ɿ"QQ&YUFOTJPOͱ͸ʁ IUUQTEFWFMPQFSBQQMFDPNKQBQQFYUFOTJPOT 9DPEFͷ/FXˠ5BSHFUͰ֬ೝͰ͖Δ

    "QQ&YUFOTJPOͷςϯϓϨʔτҰཡ IUUQTEFWFMPQFSBQQMFDPNMJCSBSZBSDIJWFEPDVNFOUBUJPO(FOFSBM$PODFQUVBM&YUFOTJCJMJUZ1(JOEFYIUNM
  40. 4DSFFO5JNF"1* %FWJDF"DUJWJUZ.POJUPSɿ؂ࢹ݁ՌΛ΋ͱʹίʔυ࣮ߦ import DeviceActivity class MyMonitorExtension: DeviceActivityMonitor { override func

    intervalDidStart(for activity: DeviceActivityName) { super.intervalDidStart(for: activity) } override func intervalDidEnd(for activity: DeviceActivityName) { super.intervalDidEnd(for: activity) } override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) // ಛఆͷΞΫςΟϏςΟͷ࢖༻͕࣌ؒᮢ஋ʹୡͨ͠Βɺ͕͜͜ݺ͹ΕΔʢΞϓϦΛىಈ͍ͯ͠ͳͯ͘΋ʣ } } ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻIUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZEFWJDFBDUJWJUZNPOJUPS
  41. IUUQTUXJUUFSDPNZVKJG@TUBUVT ࣮ݱͰ͖ΔͷͰ͸ʜʜʂʁ

  42. 4DSFFO5JNF"1* ManagedSettings DeviceActivity FamilyControls อޢऀΞΧ΢ϯτʹΑΔঝೝ ϓϥΠόγʔͷอޢ ར༻੍ݶͷ੍ޚ ࢖༻ঢ়گͷ؂ࢹ ΞϓϦىಈͤͣίʔυ࣮ߦ ΞϓϦ͔Β੍ݶͷઃఆɾղআ

    IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO.BOBHFE4FUUJOHT IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO%FWJDF"DUJWJUZ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO'BNJMZ$POUSPMT ͭͷ'SBNFXPSL
  43. 4DSFFO5JNF"1* %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹ import DeviceActivity class MyMonitorExtension: DeviceActivityMonitor { override func

    eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) // ಛఆͷΞΫςΟϏςΟͷ࢖༻͕࣌ؒᮢ஋ʹୡͨ͠Βɺ͕͜͜ݺ͹ΕΔʢΞϓϦΛىಈ͍ͯ͠ͳͯ͘΋ʣ } } ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOEFWJDFBDUJWJUZEFWJDFBDUJWJUZNPOJUPS
  44. 4DSFFO5JNF"1* %FWJDF"DUJWJUZ .BOBHFE4FUUJOHTɿ؂ࢹ ར༻੍ݶͷ੍ޚ import DeviceActivity import ManagedSettings class MyMonitorExtension:

    DeviceActivityMonitor { let store = ManagedSettingsStore() override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) // ಛఆͷΞΫςΟϏςΟͷ࢖༻͕࣌ؒᮢ஋ʹୡͨ͠Βɺ͕͜͜ݺ͹ΕΔʢΞϓϦΛىಈ͍ͯ͠ͳͯ͘΋ʣ } } ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONBOBHFETFUUJOHTNBOBHFETFUUJOHTTUPSF
  45. 4DSFFO5JNF"1* %FWJDF"DUJWJUZ .BOBHFE4FUUJOHTɿ؂ࢹ ར༻੍ݶͷ੍ޚ import DeviceActivity import ManagedSettings class MyMonitorExtension:

    DeviceActivityMonitor { let store = ManagedSettingsStore() override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { super.eventDidReachThreshold(event, activity: activity) if event == .encouraged { // ਪ঑ΠϕϯτʢྫɿֶशܥΞϓϦΛ30෼࢖͏ʣΛୡ੒ͨ͠Βɺ͢΂ͯͷΞϓϦ΁ͷར༻੍ݶΛղআ͢Δ store.shield.applications = nil } } } ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONBOBHFETFUUJOHTNBOBHFETFUUJOHTTUPSF
  46. ৭ʑͰ͖ͦ͏ʜʜʂ

  47. 4DSFFO5JNF"1* .BOBHFE4FUUJOHT4UPSFɿ༷ʑͳ੍ݶͷઃఆ w ΞϓϦ΍8FCͷγʔϧυҎ֎ʹ΋ɺ৭ʑͳ߲໨ΛઃఆͰ͖Δ ‣ σόΠε੍ݶܥ ΞΧ΢ϯτ৘ใ ϞόΠϧ௨৴ ύείʔυ ʜʜ

    ‣ ίϯςϯπϑΟϧλϦϯάܥ "QQ4UPSF՝ۚ (BNF$FOUFS ϨʔςΟϯά੍ݶ ʜʜ ‣ 8FCίϯςϯπͷ੍ݶܥ 4BGBSJͷ$PPLJFϙϦγʔ ʜʜ ‣ ʜʜ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONBOBHFETFUUJOHTNBOBHFETFUUJOHTTUPSF ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPONBOBHFETFUUJOHTΑΓ
  48. 4DSFFO5JNF"1* .BOBHFE4FUUJOHT6*ɿγʔϧυͷݟͨ໨Λม͑Δ w γʔϧυͷϘλϯ΍ ΞΠίϯɺλΠτϧɺ ৭ͳͲΛมߋͰ͖Δ w ΞϓϦͷಛੑʹ͋ͬͨ ར༻੍ݶ࣌ͷԋग़ʹ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO.BOBHFE4FUUJOHT6*

    ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ .FFUUIF4DSFFO5JNF"1*IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXEDΑΓ
  49. 4DSFFO5JNF"1* ManagedSettings DeviceActivity FamilyControls อޢऀΞΧ΢ϯτʹΑΔঝೝ ϓϥΠόγʔͷอޢ ར༻੍ݶͷ੍ޚ ࢖༻ঢ়گͷ؂ࢹ ΞϓϦىಈͤͣίʔυ࣮ߦ ΞϓϦ͔Β੍ݶͷઃఆɾղআ

    IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO.BOBHFE4FUUJOHT IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO%FWJDF"DUJWJUZ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO'BNJMZ$POUSPMT ͭͷ'SBNFXPSL
  50. 'BNJMZ$POUSPMTʁ

  51. 4DSFFO5JNF"1* લఏɿ͋͘·ͰϖΞϨϯλϧίϯτϩʔϧ w J$MPVEͷʮϑΝϛϦʔڞ༗ʯͱڧ͘ඥ෇͍͍ͯΔ ‣ 4DSFFO5JNF"1*Λ࢖͏ʹ͸ɺอޢऀͷঝೝ͕ඞཁ  ͓ࢠ༷༻J$MPVEΞΧ΢ϯτ͚ͩͰ࢖͑Δʂʂʂ  ௨ৗΞΧ΢ϯτʢ؅ཧऀอޢऀଆʣͰ͸࢖͑ͳ͍

    w "QQMFͷ%FWFMPQFS'PSVNTͰ΋ҙݟ͕౤ߘ͞Ε͍ͯΔ IUUQTEFWFMPQFSBQQMFDPNGPSVNTUISFBE ‣ େਓͩͬͯ΄͍͠ʂࣗݾ؅ཧ͍ͨ͠ʂʂʂ
  52. 4DSFFO5JNF"1* 'BNJMZ$POUSPMTɿอޢऀΞΧ΢ϯτʹΑΔঝೝ import FamilyControls AuthorizationCenter.shared.requestAuthorization { result in switch result

    { case .success: break case .failure(let error): …… } } ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOGBNJMZDPOUSPMTBVUIPSJ[BUJPODFOUFS w ঝೝΛٻΊΔ࣮૷͸؆୯ w ঝೝޙɺࣗಈͰ੍໿͕ͭ͘ ‣ อޢऀҎ֎͸ͦͷΞϓϦΛ ফͤͳ͘ͳΔ ‣ J$MPVE͔ΒαΠϯΞ΢τ Ͱ͖ͳ͘ͳΔ
  53. ϓϥΠόγʔͷอޢ

  54. 4DSFFO5JNF"1* લఏɿϓϥΠόγʔอޢͷॏࢹ ͲΜͳΞϓϦ΍8FCΛӾཡ͔ͨ͠ɺ ຊਓͱอޢऀҎ֎ʹ͸෼͔Βͳ͍ઃܭ w ར༻ΞϓϦ΍ӾཡαΠτ͝ͱʹ PQBRVFτʔΫϯ͕ఏڙ͞ΕΔ ‣ %FWJDF"DUJWJUZ .BOBHFE4FUUJOHTͰ

    ର৅ͷࢦఆʹ࢖͏ w ΞϓϦ໊΍63-͸औಘͰ͖ͳ͍ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOGBNJMZDPOUSPMTGBNJMZBDUJWJUZ ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ
  55. 4DSFFO5JNF"1* 'BNJMZ"DUJWJUZ1JDLFSɿର৅ͷબ୒ͱτʔΫϯऔಘ w 4XJGU6*Ͱઐ༻ͷ ίϯϙʔωϯτ͕ ఏڙ͞Ε͍ͯΔ w ϢʔβʔʹΑΔબ୒Ͱ ॳΊͯτʔΫϯΛऔಘ Ͱ͖Δ

    import FamilyControls struct ContentView: View { @State var selection = FamilyActivitySelection() var body: some View { VStack { FamilyActivityPicker(selection: $selection) } } } IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOGBNJMZDPOUSPMTGBNJMZBDUJWJUZQJDLFS ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ ˞ࢀߟɿJ04ʹ͋Δྨࣅը໘ ʢεΫϦʔϯλΠϜͷ੍ݶઃఆʣ w DBUFHPSZ5PLFOT w BQQMJDBUJPO5PLFOT w XFC%PNBJO5PLFOT
  56. 4DSFFO5JNF"1* ManagedSettings DeviceActivity FamilyControls อޢऀΞΧ΢ϯτʹΑΔঝೝ ϓϥΠόγʔͷอޢ ར༻੍ݶͷ੍ޚ ࢖༻ঢ়گͷ؂ࢹ ΞϓϦىಈͤͣίʔυ࣮ߦ ΞϓϦ͔Β੍ݶͷઃఆɾղআ

    IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO.BOBHFE4FUUJOHT IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO%FWJDF"DUJWJUZ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPO'BNJMZ$POUSPMT ͭͷ'SBNFXPSL
  57. 4DSFFO5JNF"1*͸ ࣗݾ؅ཧʹ׆༻Ͱ͖Δͷ͔ʜʜʁ#

  58. ࣌ؒΛ͏·͘࢖͑ΔΑ͏ʹͳΓ͍ͨʜʜ ˣ ɾ࢖్ෆ໌࣌ؒΛ೺Ѳ͍ͨ͠ ɾ༧ଌͱݱ࣮ͷζϨΛೝ͍ࣝͨ͠ ˣ ݟੵΓΛਫ਼៛Խͯ͠ɺ༧ఆ௨ΓʹਐΊ΍͍͢ঢ়ଶʹ͍ͨ͠

  59. 4DSFFO5JNF"1* ࣮ݱͰ͖ΔͷͰ͸ʁͱໝ૝͍ͯͨ͜͠ͱ w J1IPOF.BDͰ͍ͭԿΛ͔ͨ͠Λऔಘ ˣ w ࣗ࡞ͷ࣌ؒɾλεΫ؅ཧπʔϧʹࣗಈه࿥ ˣ w ࣌ؒͷ࢖͍ํͷશ๴Λ೺ѲͰ͖Δ

  60. 4DSFFO5JNF"1* ࣮ݱͰ͖ΔͷͰ͸ʁͱໝ૝͍ͯͨ͜͠ͱ w J1IPOF.BDͰ͍ͭԿΛ͔ͨ͠Λऔಘ ˣ w ࣗ࡞ͷ࣌ؒɾλεΫ؅ཧπʔϧʹࣗಈه࿥ ˣ w ࣌ؒͷ࢖͍ํͷશ๴Λ೺ѲͰ͖Δ

    ͓ࢠ༷༻ΞΧ΢ϯτݶఆ'
  61. 4DSFFO5JNF"1* ࣮ݱͰ͖ΔͷͰ͸ʁͱໝ૝͍ͯͨ͜͠ͱ w J1IPOF.BDͰ͍ͭԿΛ͔ͨ͠Λऔಘ ˣ w ࣗ࡞ͷ࣌ؒɾλεΫ؅ཧπʔϧʹࣗಈه࿥ ˣ w ࣌ؒͷ࢖͍ํͷશ๴Λ೺ѲͰ͖Δ

    ͓ࢠ༷༻ΞΧ΢ϯτݶఆ' ϓϥΠόγʔ΁ͷ഑ྀ͔Β ಺༰ͷશࣗಈऔಘ͸ෆՄೳ
  62. 4DSFFO5JNF"1*͸ ͲͷΑ͏ͳΞϓϦͰ࢖͏ͷ͔ʁ

  63. 4DSFFO5JNF"1* ͋ͳͨͷΞϓϦͰ࢖͏ͳΒʜʜʁ w ϢʔβʔʹࢠͲ΋ؚ͕·ΕΔΞϓϦͰ͸׆༂ͦ͠͏ ‣ ྫɿֶशܥɺΤϯλϝܥɺʜʜ w ϞόΠϧσόΠε؅ཧʢ.%.ʣҎ֎ͷબ୒ࢶΛఏڙͰ͖Δ ‣ อޢऀҎ֎͕ղআͰ͖ͳ͍8FCίϯςϯπͷϑΟϧλ

    ‣ ୯७ͳ੍࣌ؒݶ͚ͩͰ͸ͳ͘ɺ༷ʑͳ৚݅Ͱ੍ݶɾղআ͢Δ࢓૊Έ ‣ ʜʜ
  64. ࠓޙʹ޲͚ͯ

  65. 4DSFFO5JNF"1*ͷൃల w 4DSFFO5JNF"1*ͷ1SPQPTBM ‣ ࣮ݱ͞Ε͍ͯͳ͍࢓༷΋͋Δ   w ͜͏ͳͬͨΒ͍͍ͳʜʜ( ‣

    ͓ࢠ༷༻ΞΧ΢ϯτҎ֎Ͱ΋࢖͑Δ ‣ NBD04ʹ΋"1*ఏڙ͞ΕΔ ࠓޙʹ޲͚ͯ IUUQTTDSFFOUJNFBQJDPNTDSFFOUJNFBQJ GVODRVFSZ&WFOUT GSPN%BUF UP%BUF  ɹɹɹɹɹɹɹɹɹFWFOU5ZQFT<PQFO"QQ DMPTF"QQ> <&WFOU>
  66. 4DSFFO5JNF"1*ͷൃల w 4DSFFO5JNF"1*ͷ1SPQPTBM ‣ ࣮ݱ͞Ε͍ͯͳ͍࢓༷΋͋Δ   w ͜͏ͳͬͨΒ͍͍ͳʜʜ( ‣

    ͓ࢠ༷༻ΞΧ΢ϯτҎ֎Ͱ΋࢖͑Δ ‣ NBD04ʹ΋"1*ఏڙ͞ΕΔ ࠓޙʹ޲͚ͯ IUUQTTDSFFOUJNFBQJDPNTDSFFOUJNFBQJ GVODRVFSZ&WFOUT GSPN%BUF UP%BUF  ɹɹɹɹɹɹɹɹɹFWFOU5ZQFT<PQFO"QQ DMPTF"QQ> <&WFOU>
  67. ࣗݾ؅ཧʹ͸ผͷσʔλ΋׆༻ ࠓޙʹ޲͚ͯ 4DSFFO5JNF"1*Ҏ֎ʹ΋ɺ৭ʑͳํ๏Ͱࣗಈه࿥ w ࣗ୐಺ͷ༷ʑͳηϯαʔ ‣ ΧϝϥʗೋࢎԽ୸ૉೱ౓ܭʗʜʜ w NBD04্ͷσʔλ ‣

    ΞΫςΟϒͳ΢Οϯυ΢ʗϒϥ΢βͷཤྺʗʜʜ w "QQMF੡඼ ‣ )FBMUI,JUʜʜਭ຾΍ӡಈͷ࣌ؒ ‣ /FBSCZ*OUFSBDUJPO'SBNFXPSLʜʜՈͷதͰͷߦಈ ‣ ʜʜ IUUQTEFWFMPQFSBQQMFDPNWJEFPTQMBZXXED
  68. ·ͱΊ ࣗݾ؅ཧͷເͱ4DSFFO5JNF"1* w എܠ ‣ ࣌ؒɾλεΫ؅ཧͷͨΊʹɺࣗ෼ʹ߹ͬͨ࠷ߴͷπʔϧ͕΄͍͠ ‣ ࢖్ෆ໌࣌ؒΛ೺ѲͰ͖ΔΑ͏ʹɺ͋ΒΏΔߦಈΛࣗಈͰه࿥ͯ͠Έ͍ͨ w 4DSFFO5JNF"1*͕J04͔Βొ৔͢Δ͕ɺݱঢ়Ͱ࢖͑Δͷ͸͓ࢠ༷༻J$MPVEΞΧ΢ϯτͷΈ

    ‣ %FWJDF"DUJWJUZɿ࢖༻ঢ়گͷ؂ࢹʗ؂ࢹ݁ՌΛ΋ͱʹίʔυ࣮ߦ ‣ .BOBHFE4FUUJOHTɿ༷ʑͳར༻੍ݶͷઃఆɾղআ ‣ 'BNJMZ$POUSPMTɿอޢऀΞΧ΢ϯτʹΑΔঝೝʗϓϥΠόγʔอޢͷͨΊͷτʔΫϯఏڙ w 4DSFFO5JNF"1*Ҏ֎ʹ΋ɺ৭ʑࢼ͠ͳ͕Βࣗݾ؅ཧͷͨΊͷπʔϧΛ࡞͍͖͍ͬͯͨ) ࣌఺ͷ৘ใͰ͢ɻ#FUBͷͨΊมߋ͞Ε͍ͯΔ৔߹͕͋Γ·͢ɻ
  69. IUUQTDPPLQBEDPOOQBTTDPNFWFOU w 4XJGU6* w $PNQPTJUJPOBM-BZPVUT w ػೳ୯ҐͷϛχΞϓϦ w .VMUJQFFS$POOFDUJWJUZ ɹ౳ͷτϐοΫͰ࿩͠·͢ʂ