WWWDC
  • ์ „์ฒด ๋ณด๊ธฐ
  • Accessibility & Inclusion
    • Build global apps: Localization by example
  • App Services
    • Meet WeatherKit
  • Audio & Video
    • What's New in AVAudioEngine
  • App Store Distribution & Marketing
    • Distribute apps in Xcode with cloud signing
  • Argumented Reality
  • Business & Education
    • Meet the Screen Time API
    • What's new in Screen Time API
  • Design
  • Developer Tools
    • Testing in Xcode
    • Meet TestFlight on Mac
    • Advances in App Background Execution
  • Essentials
  • Graphics & Games
  • Health & Fitness
  • Maps & Location
  • ML & Vision
  • Photo & Camera
  • Privacy & Security
    • Get to know Developer Mode
  • Safari & Web
    • What's new in WKWebView
  • Swift
    • ARC in Swift: Basics and beyond
    • Swift concurrency: Behind the scenes
    • Embrace Swift generics
    • Explore structured concurrency in Swift
    • Meet async/await in Swift
    • Meet Swift Regex
  • SwiftUI & UI Frameworks
    • Binary Frameworks in Swift
  • System Services
Powered by GitBook
On this page
  • What's new in Screen Time API
  • ๐Ÿ”ต ์ง€๋‚œ iOS15 ๋ฆด๋ฆฌ์ฆˆ ์ฃผ์š” ์‚ฌํ•ญ
  • ๐Ÿ”น Family Controls
  • ๐Ÿ”น Managed Setting
  • ๐Ÿ”น Device Activity
  • ๐Ÿ”ต iOS16 ๋ฐ๋ชจ ์•ฑ : Worklog
  • ๐Ÿ”น NEW Family Controls
  • ๐Ÿ”น Managed Settings Store
  • ๐Ÿ”น DeviceActivity
  1. Business & Education

What's new in Screen Time API

What's new in Screen Time API

๐Ÿ”ต ์ง€๋‚œ iOS15 ๋ฆด๋ฆฌ์ฆˆ ์ฃผ์š” ์‚ฌํ•ญ

๐Ÿ”น Family Controls

  • Screen Time API์— ๋Œ€ํ•œ ์—‘์„ธ์Šค ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜๋Š” ์—ญํ• . ๋ณธ์งˆ์  ๊ฒŒ์ดํŠธ์›จ์ด

  • ์ž๋…€ ๋ณดํ˜ธ ์•ฑ ์ œ๊ฑฐ & ์šฐํšŒ ๋ฐฉ์ง€

  • ๊ฐ€์กฑ์ด ์‚ฌ์šฉํ•˜๋Š” ์•ฑ์„ ์œ„ํ•œ ๊ฐœ์ธ ์ •๋ณด ๋ณดํ˜ธ ํ† ํฐ

๐Ÿ”น Managed Setting

  • ๊ธฐ๊ธฐ์— ์ง€์†์ ์ธ ์ œํ•œ ์„ค์ • ๊ธฐ๋Šฅ

  • ์›น ์ฝ˜ํ…์ธ  ํ•„ํ„ฐ๋ง ์ œ๊ณต

  • ๋งž์ถคํ˜• UI๋กœ ์•ฑ&์›น ๋ณดํ˜ธ

๐Ÿ”น Device Activity

  • ๋””๋ฐ”์ด์Šค ํ™œ๋™ ์ผ์ •์˜ ์‹œ์ž‘ ๋ฐ ์ข…๋ฃŒ ์‹œ ์ฝ”๋“œ ์‹คํ–‰

  • ์‚ฌ์šฉ ํ•œ๊ณ„์น˜ ๋„๋‹ฌ ์‹œ ์ฝ”๋“œ ์‹คํ–‰

๐Ÿ”ต iOS16 ๋ฐ๋ชจ ์•ฑ : Worklog

ํŠน์ • ์ˆ˜์น˜๋“ค์ด ์ถฉ์กฑ๋  ๋•Œ๊นŒ์ง€ ํŠน์ • ์•ฑ์˜ ์‚ฌ์šฉ์„ ์ œํ•œํ•˜๋Š” ๊ธฐ๋Šฅ

๐Ÿ”น NEW Family Controls

iOS15 iCloud ์Šน์ธ์„ ํ†ตํ•ด์„œ๋งŒ ์ž๋…€์˜ ๊ธฐ๊ธฐ๋ฅผ ์Šน์ธํ•  ์ˆ˜ ์žˆ์—ˆ์Œ

โ†’ iOS16 ์ž์‹ ์˜ ๊ธฐ๊ธฐ์—์„œ ๊ฐœ๋ณ„ ์‚ฌ์šฉ์ž๋ฅผ ์Šน์ธํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋˜์—ˆ์Œ

  • ๊ฐœ๋ณ„ ์‚ฌ์šฉ์ž๊ฐ€ ์Šค์Šค๋กœ ์ธ์ฆ

  • ์—ฌ๋Ÿฌ ๊ฐœ์˜ ๊ฐœ๋ณ„ ์ธ์ฆ

  • ๊ฐœ๋ณ„ ์ธ์ฆ์— ๋Œ€ํ•œ ์•ฑ ์ œ๊ฑฐ ๋˜๋Š” iCloud ๋กœ๊ทธ์•„์›ƒ ์ œํ•œ ์—†์Œ

import FamilyControls

let center = AuthorizationCenter.shared

Task {
	do {
		try await center.requestAuthorization(for: .individual)
	} catch {
		print(error)
	}
}

๊ธฐ์กด ์ฝ”๋“œ๋ณด๋‹ค ํ›จ์”ฌ ๊ฐ„๊ฒฐํ•ด์กŒ๋‹ค.

๐Ÿ”น Managed Settings Store

ํ˜„์žฌ ์‚ฌ์šฉ์ž๋‚˜ ๊ธฐ๊ธฐ์— ์„ค์ •์„ ์ ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ ์ €์žฅ์†Œ

iOS15 ํ”„๋กœ์„ธ์Šค๋‹น ํ•˜๋‚˜์˜ ManagedSettingsStore ๋งŒ ํ—ˆ์šฉ๋จ, ๋˜ํ•œ ์•ฑ๊ณผ DeviceActivity์˜ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์€ ๋ณ„๋„๋กœ ManagedSettingsStore๊ฐ€ ํ•„์š”ํ•ด์„œ DeviceActivity์— ๋Œ€ํ•œ ์‘๋‹ต์—์„œ ์„ค์ •์„ ๋ณ€๊ฒฝํ•˜๊ธฐ ์–ด๋ ค์› ์Œ

โ†’ iOS16 ํ”„๋กœ์„ธ์Šค๋งˆ๋‹ค ๊ณ ์œ ํ•œ ์ด๋ฆ„์„ ๊ฐ€์ง„ ManagedSettingsStore๋ฅผ ์ตœ๋Œ€ 50๊ฐœ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Œ. ์ด๋ ‡๊ฒŒ ๋ช…๋ช…๋œ ManagedSettingsStore๋“ค(Named stores)์€ ์•ฑ๊ณผ ๋ชจ๋“  ์•ฑ ํ™•์žฅํ”„๋กœ๊ทธ๋žจ์—์„œ ์ž๋™์œผ๋กœ ๊ณต์œ ๋จ. ๋ชจ๋“  Named stores์—์„œ ํ•œ๋ฒˆ์— ์„ค์ • ์ œ๊ฑฐ๋„ ๊ฐ€๋Šฅํ•ด์ง

import ManagedSettings

extension ManagedSettingsStore.Name {
    static let youTube = Self("YouTube")
}

final class BlockingManager {
    func managedSettingStoreSetup() {
        let youTubeCategory = ActivityCategoryToken() // ์ด๊ฑฐ ์•ˆ๋จ
        let youTubeStore = ManagedSettingsStore(named: .youTube)
        youTubeStore.shield.applicationCategories = .specific(except: [youTubeCategory])
        youTubeStore.shield.webDomainCategories = .specific(except: [youTubeCategory])
    }
}

์˜์ƒ์—์„  ActivityCategoryToken์— ๋Œ€ํ•œ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ์•Œ๋ ค์ฃผ์ง€ ์•Š์•„์„œ ๋”ฐ๋กœ ์ฐพ์•„๋ดค๋‹ค.

FamilyActivityPicker** ์—์„œ ์œ ์ €๊ฐ€ ์„ ํƒํ•œ ์•ฑ๋“ค์˜ ์ •๋ณด๋ฅผ FamilyActivitySelection์— ๋‹ด์•„ model์— ์ „๋‹ฌํ•œ๋‹ค.

// APP: Choose the Apps to Discourage

import FamilyControls
import SwiftUI

@StateObject var model = MyModel()
@State var isPresented = false

var body: some View {
		Button("Select Apps to Discourage") {
				isPresented = true
		}
		.familyActivityPicker(isPresented: $isPresented, selection: $model.selectionTpDiscourage)
}

๋ฌธ์ œ๋Š” SwiftUI ์ฝ”๋“œ๋ผ์„œ UIHostingController๋ฅผ ์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค.

์•„๋ฌดํŠผ ๋‚˜๋จธ์ง€ ์ฝ”๋“œ๋ฅผ ๋จผ์ € ์‚ดํŽด๋ณด์ž๋ฉด

import SwiftUI
import DeviceActivity

extension DeviceActivityName {
		static let activity = Self("activity")
}

let deviceActivityCenter = DeviceActivityCenter()

Button("Allow for Evening") {
                try? deviceActivityCenter.startMonitoring(
                    .activity,
                    during: DeviceActivitySchedule(
                        intervalStart: DateComponents(hour: 18),
                        intervalEnd: DateComponents(hour: 20),
                        repeats: true)
                )
            }
import DeviceActivity
import ManagedSettings

final class BlockingMonitor: DeviceActivityMonitor {
    
    // let database = BarkDataBase() //TODO: Make database for Token of the published category
    override func intervalDidStart(for activity: DeviceActivityName) {
        super.intervalDidStart(for: activity)
        let youTubeStore = ManagedSettingsStore(named: .youTube)
        youTubeStore.clearAllSettings() //youTube ์ œ์•ฝ์ด ์‹œ์ž‘๋˜๋ฉด ์ด์ „์˜ ์ œ์•ฝ์„ ๋ชจ๋‘ clearํ•œ๋‹ค.
    }
    override func intervalDidEnd(for activity: DeviceActivityName) {
        super.intervalDidEnd(for: activity)
        
        let appStore = ManagedSettingsStore(named: .youTube)
//        let appCategory = database.appCategoryToken //TODO: Make database for save&load `youTubeCategoryToken`
        youTubeStore.shield.applicationCategories = .specific([youTubeStore])
        youTubeStore.shield.webDomainCategories = .specific([youTubeStore])
    }
}

๐Ÿ”น DeviceActivity

ํ˜„์žฌ ์‚ฌ์šฉ์ž๋‚˜ ๊ธฐ๊ธฐ์— ์„ค์ •์„ ์ ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ ์ €์žฅ์†Œ

iOS15 ์•ฑ๊ณผ ์›น ์‚ฌ์ดํŠธ์— ๋Œ€ํ•œ ์‚ฌ์šฉ๋Ÿ‰ ํ—ˆ์šฉ์น˜์™€ ์‚ฌ์šฉ ์‹œ๊ฐ„๋Œ€์— ๋ฐ˜์‘ํ–ˆ์Œ

โ†’ iOS16 SwiftUI๋ฅผ ์‚ฌ์šฉํ•œ ์‚ฌ์šฉ์ž ์ง€์ • ์‚ฌ์šฉ๋Ÿ‰ ๋ณด๊ณ ์„œ๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ๊ฒŒ ๋์Œ. ์‚ฌ์šฉ๋Ÿ‰ ๋ฐ์ดํ„ฐ๋Š” ์ƒˆ๋กœ์šด ํ™•์žฅ ํฌ์ธํŠธ๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ์ž์—๊ฒŒ ํ‘œ์‹œ๋  ๋ฐ์ดํ„ฐ์™€ ํ™”๋ฉด์— ํ‘œํ˜„๋  ๋ฐฉ์‹์„ ์‚ฌ์šฉ์ž ์ •์˜ ํ•  ์ˆ˜ ์žˆ์Œ. ์ด๋ฅผ DeviceActivityReport๋Š” ์ตœ์ข… ์‚ฌ์šฉ์ž์˜ ๊ฐœ์ธ์ •๋ณด ๋ณดํ˜ธ๋ฅผ ๋ณด์žฅํ•จ

์ด๊ฑธ ์ด์šฉํ•ด์„œ ๋ณด๊ณ ์„œ๋ฅผ ๊ฐœ์ธํ™”ํ•˜์—ฌ ๋ทฐ์— ํ‘œ์‹œํ•  ์ˆ˜ ์žˆ๊ณ , ์›ํ•˜๋Š” ์ฐจํŠธํƒ€์ž… ๋ทฐ๋ฅผ ๊ตฌํ˜„ํ•ด์„œ ๋ณด์—ฌ์ฃผ๋ฉด ๋œ๋‹ค๋Š”๋ฐ ๋๊นŒ์ง€ ๋‹ค ๋ณด๊ณ  ์ ์šฉ์‹œ์ผœ๋ณด๋ ค๊ณ  SwiftUI ํ”„๋กœ์ ํŠธ ์˜ˆ์ œ๋„ ํ•ด๋ดค๋Š”๋ฐ, ์ฝ”๋“œ๋ฅผ ๋„ˆ๋ฌด ์ผ๋ถ€๋งŒ ๋ณด์—ฌ์ฃผ๊ณ  ์ƒ˜ํ”Œ ์ฝ”๋“œ์กฐ์ฐจ ๊ณต๊ฐœ๋ฅผ ํ•ด๋†“์ง€ ์•Š์•„์„œ ๋„๋Œ€์ฒด ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•˜๋ผ๋Š” ๊ฑด์ง€ ๋ชจ๋ฅด๊ฒ ๋‹ค!

๋‚˜๋จธ์ง€๋Š” ๊ณต์‹๋ฌธ์„œ๋ฅผ ๋ณด๊ณ  ์ง์ ‘ ์ดํ•ดํ•˜๊ณ  ์ ์šฉํ•ด๋ณด๋Š” ์ˆ˜ ๋ฐ–์— ์—†๋Š” ๋“ฏ ํ•˜๋‹ค.

PreviousMeet the Screen Time APINextDesign

Last updated 2 years ago

์—ฌ๊ธฐ๊นŒ์ง€ ๋ณด๊ณ  ์ด์ „์— ๋ฅผ ์‚ดํŽด๋ดค๋‹ค.

How to use categories in Managed Sโ€ฆ | Apple Developer Forums
ActivityCategoryToken | Apple Developer Documentation
FamilyActivitySelection | Apple Developer Documentation
FamilyActivityPicker | Apple Developer Documentation
์ž‘์„ฑํ–ˆ๋˜ ์˜ˆ์ œ
Is it possible to use familly actiโ€ฆ | Apple Developer Forums
Use SwiftUI in UIKit View Controllers with UIHostingController
UIHostingController in SwiftUI 2020 (Use in UIViewController) - How To Bridge UIKit with SwiftUI.