Skip to content
Permalink
416c2ea748
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
34 lines (29 sloc) 954 Bytes
//
// PlistUtil.swift
// SynchronyFinancial WatchKit Extension
//
// Created by Jonathan Duarte on 2/17/19.
// Copyright © 2019 Alan Maynard. All rights reserved.
//
import Foundation
public enum PlistDataType: String {
case balance = "BalanceInfo"
case transaction = "Transcation"
case account = "Account"
}
class PlistUtil {
static func readPlist(for data: PlistDataType) -> [[Int]] {
var balances = [[Int]]()
if let file = Bundle.main.path(forResource: data.rawValue, ofType: "plist"),
let array = NSArray.init(contentsOfFile: file) {
array.forEach {
guard let balance = $0 as? [AnyHashable],
let b = balance[0] as? Int,
let credit = balance[1] as? Int,
let age = balance[2] as? Int else { return }
balances.append([b, credit, age])
}
}
return balances
}
}