<commit_before>//
//  ExportOPMLAccessoryViewController.swift
//  NetNewsWire
//
//  Created by <NAME> on 2019-10-20.
//  Copyright © 2019 Ranchero Software. All rights reserved.
//

import AppKit
import Account

class ExportOPMLAccessoryViewController: NSViewController {

	@IBOutlet weak var accountPopUpButton: NSPopUpButton!
	weak var delegate: ExportOPMLAccessoryViewControllerDelegate?

	var selectedAccount: Account? {
		accountPopUpButton.selectedItem?.representedObject as? Account
	}

	init(delegate: ExportOPMLAccessoryViewControllerDelegate) {
		super.init(nibName: "ExportOPMLAccessoryView", bundle: nil)
		self.delegate = delegate
	}

	// MARK: - NSViewController

	required init?(coder: NSCoder) {
		preconditionFailure("ExportOPMLAccessoryView.init(coder) not implemented by design.")
	}

	override func viewDidLoad() {
		accountPopUpButton.removeAllItems()

		let menu = NSMenu()
		accountPopUpButton.menu = menu

		for oneAccount in AccountManager.shared.sortedAccounts {

			let oneMenuItem = NSMenuItem()
			oneMenuItem.title = oneAccount.nameForDisplay
			oneMenuItem.representedObject = oneAccount
			menu.addItem(oneMenuItem)

			if oneAccount.accountID == AppDefaults.exportOPMLAccountID {
				accountPopUpButton.select(oneMenuItem)
			}

		}
	}
<commit_msg>Make delegate-less init() fail since a delegate is currently required<commit_after>//
//  ExportOPMLAccessoryViewController.swift
//  NetNewsWire
//
//  Created by <NAME> on 2019-10-20.
//  Copyright © 2019 Ranchero Software. All rights reserved.
//

import AppKit
import Account

class ExportOPMLAccessoryViewController: NSViewController {

	@IBOutlet weak var accountPopUpButton: NSPopUpButton!
	weak var delegate: ExportOPMLAccessoryViewControllerDelegate?

	var selectedAccount: Account? {
		accountPopUpButton.selectedItem?.representedObject as? Account
	}

	init(delegate: ExportOPMLAccessoryViewControllerDelegate) {
		super.init(nibName: "ExportOPMLAccessoryView", bundle: nil)
		self.delegate = delegate
	}

	init() {
		preconditionFailure("init() without delegate not implemented by design.")
	}

	required init?(coder: NSCoder) {
		preconditionFailure("ExportOPMLAccessoryView.init(coder) not implemented by design.")
	}

	override func viewDidLoad() {
		accountPopUpButton.removeAllItems()

		let menu = NSMenu()
		accountPopUpButton.menu = menu

		for oneAccount in AccountManager.shared.sortedAccounts {

			let oneMenuItem = NSMenuItem()
			oneMenuItem.title = oneAccount.nameForDisplay
			oneMenuItem.representedObject = oneAccount
			menu.addItem(oneMenuItem)

			if oneAccount.accountID == AppDefaults.exportOPMLAccountID {
				accountPopUpButton.select(oneMenuItem)
			}

		}
	}

{'fraction_non_alphanumeric': 0.08582089552238806, 'fraction_numerical': 0.008955223880597015, 'mean_word_length': 4.93141592920354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2979184', 'n_tokens_mistral': 895, 'n_tokens_neox': 771, 'n_words': 177}