mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Added initial POC version of NetNewsWire for iOS to use as a starting point for the actual app.
This commit is contained in:
40
iOS/Add Feed/AddFeedFolderPickerData.swift
Normal file
40
iOS/Add Feed/AddFeedFolderPickerData.swift
Normal file
@@ -0,0 +1,40 @@
|
||||
//Copyright © 2019 Vincode, Inc. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
import Account
|
||||
import RSCore
|
||||
import RSTree
|
||||
|
||||
struct AddFeedFolderPickerData {
|
||||
|
||||
var containerNames = [String]()
|
||||
var containers = [Container]()
|
||||
|
||||
init() {
|
||||
|
||||
let treeControllerDelegate = FolderTreeControllerDelegate()
|
||||
|
||||
let rootNode = Node(representedObject: AccountManager.shared.localAccount, parent: nil)
|
||||
rootNode.canHaveChildNodes = true
|
||||
let treeController = TreeController(delegate: treeControllerDelegate, rootNode: rootNode)
|
||||
|
||||
guard let rootNameProvider = treeController.rootNode.representedObject as? DisplayNameProvider else {
|
||||
return
|
||||
}
|
||||
|
||||
let rootName = rootNameProvider.nameForDisplay
|
||||
containerNames.append(rootName)
|
||||
containers.append(treeController.rootNode.representedObject as! Container)
|
||||
|
||||
treeController.rootNode.childNodes.forEach { node in
|
||||
guard let childContainer = node.representedObject as? Container else {
|
||||
return
|
||||
}
|
||||
let childName = (childContainer as! DisplayNameProvider).nameForDisplay
|
||||
containerNames.append("\(rootName) / \(childName)")
|
||||
containers.append(childContainer)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user