스트리밍은 대부분의 브라우저와
Developer 앱에서 사용할 수 있습니다.
-
FinanceKit 소개
금융 관리 앱에 FinanceKit을 활용하면 사용자 동의 및 제어를 바탕으로 Apple Cash, Apple Card 등에서 온디바이스 데이터를 원활하고 안전하게 공유받을 수 있습니다. 계정, 거래, 잔액에 대한 일회성 접근 및 지속적인 접근을 요청하는 방법과 iOS 및 iPadOS를 위한 탁월한 경험을 빌드하는 방법을 확인해 보세요.
챕터
- 0:00 - Introduction
- 1:48 - Overview of data types
- 5:03 - Access financial data
- 21:56 - Best practices
리소스
-
다운로드Array
-
-
5:38 - Check if financial data is available
// Check if financial data is available import FinanceKit let available = FinanceStore.isDataAvailable( .financialData ) guard available else { // No meaningful action can be performed return }
-
8:08 - Present the transaction picker
// Present the transaction picker import SwiftUI import FinanceKit import FinanceKitUI struct TransactionSelector: View { @State private var selectedItems: [FinanceKit.Transaction] = [] var body: some View { if FinanceStore.isDataAvailable(.financialData) { TransactionPicker(selection: $selectedItems) { Text("Show Transaction Picker") } } }
-
12:16 - Requesting authorization for financial data
// Requesting authorization for financial data import FinanceKit let store = FinanceStore.shared guard store.isDataAvailable(for: .financialData) else { // No meaningful action can be performed return } let authStatus = await store.requestAuthorization() guard authStatus == .authorized else { // User did not grant access to financial data, stop here return }
-
15:24 - Simple query to retrieve all Apple accounts
// Simple query to retrieve all Apple accounts let store = FinanceStore.shared let sortDescriptor = SortDescriptor(\Account.displayName) let predicate = #Predicate<Account> { account in account.institutionName == "Apple" } let query = AccountQuery( sortDescriptors: [sortDescriptor], predicate: predicate ) let accounts : [Account] = try await store.accounts(query: query)
-
18:12 - Get latest 7 available balances for account
// Get latest 7 available balances for account func getBalances(account: Account) async throws -> [AccountBalance] { let sortDescriptor = SortDescriptor(\AccountBalance.asOfDate, order: .reverse) let predicate = #Predicate<AccountBalance> { balance in balance.available != nil && balance.accountId == account.id } let query = AccountBalanceQuery( sortDescriptors: [sortDescriptor], predicate: predicate, limit: 7 ) return try await store.accountBalances(query: query).reversed() }
-
20:27 - Retrieve all the transaction history for an account
// Retrieve all the transaction history for an account import FinanceKit let store = FinanceStore.shared let account: Account = ... let transactionSequence = store.transactionHistory( forAccountID: account.id ) for try await change in transactionSequence { processChanges(change.inserted, change.updated, change.deleted) }
-
21:04 - Use the history token to resume queries
// Use the history token to resume queries import FinanceKit let store = FinanceStore.shared let account: Account = ... let currentToken = loadToken() let transactionSequence = store.transactionHistory( forAccountID: account.id, since: currentToken ) for try await change in transactionSequence { processChanges(change.inserted, change.updated, change.deleted) persist(token: change.newToken) }
-
21:41 - Non monitoring resumable queries
import FinanceKit let store = FinanceStore.shared let account: Account = ... let currentToken = loadToken() let transactionSequence = store.transactionHistory( forAccountID: account.id, since: currentToken, isMonitoring: false ) for try await change in transactionSequence { processChanges(change.inserted, change.updated, change.deleted) persist(token: change.newToken) }
-
-
찾고 계신 콘텐츠가 있나요? 위에 주제를 입력하고 원하는 내용을 바로 검색해 보세요.
쿼리를 제출하는 중에 오류가 발생했습니다. 인터넷 연결을 확인하고 다시 시도해 주세요.