728x90 SMALL filter1 💡 Swift에서 배열 필터링하기: filteredTransactions 메서드 완전 해부 가계부 앱을 개발하면서 특정 조건에 맞는 거래 내역을 추려야 할 때가 많습니다.예를 들어, 이번 달에 발생한 지출만 보고 싶다거나, 7월 한 달 동안의 수입을 계산하고 싶다는 식이죠.이를 위해 만든 함수가 바로 아래의 filteredTransactions입니다.🧩 함수 선언func filteredTransactions( type: TransactionType? = nil, in date: Date, granularity: Calendar.Component = .month) -> [ExpenseModel] { let calendar = Calendar.current let filtered = transactions.filter { transaction in .. 2025. 8. 3. 이전 1 다음 728x90 LIST