{"id":20313507,"url":"https://github.com/thierryh91200/thsidebar","last_synced_at":"2026-03-07T13:02:56.036Z","repository":{"id":109025984,"uuid":"105456511","full_name":"thierryH91200/THSideBar","owner":"thierryH91200","description":"NSOutlineView and badge","archived":false,"fork":false,"pushed_at":"2020-02-20T07:54:08.000Z","size":4783,"stargazers_count":40,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T17:15:31.525Z","etag":null,"topics":["badge","codable","drag-drop","nsoutlineview","swift5"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thierryH91200.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-01T16:35:17.000Z","updated_at":"2023-09-16T15:00:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"9c73fb66-ef0a-458f-b764-afefc711ee11","html_url":"https://github.com/thierryH91200/THSideBar","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/thierryH91200/THSideBar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thierryH91200%2FTHSideBar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thierryH91200%2FTHSideBar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thierryH91200%2FTHSideBar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thierryH91200%2FTHSideBar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thierryH91200","download_url":"https://codeload.github.com/thierryH91200/THSideBar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thierryH91200%2FTHSideBar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30214618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T12:15:00.571Z","status":"ssl_error","status_checked_at":"2026-03-07T12:15:00.217Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["badge","codable","drag-drop","nsoutlineview","swift5"],"created_at":"2024-11-14T18:11:23.532Z","updated_at":"2026-03-07T13:02:56.031Z","avatar_url":"https://github.com/thierryH91200.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/Swift-5.0-orange.svg\" /\u003e\n\u003cimg src=\"https://img.shields.io/badge/platforms-mac-brightgreen.svg?style=flat\" alt=\"Mac\" /\u003e\n\u003c/p\u003e\n\n# SideBarDemo\nNSOutlineView and badge\n\n ![Alt text](https://github.com/thierryH91200/SideBarDemo/blob/master/Capture1.png)\n\n\n# THSideBar\n\n\n    THSideBar framework written in Swift for OS X\n    \n   \n\n\n[![Stargazers over time](https://starchart.cc/thierryH91200/THSideBar.svg)](https://starchart.cc/thierryH91200/THSideBar)\n\n\n# Usage\n\n### look at example\n\n## Initialize the THSideBar\n\n```\n    var sideBarViewController :  THSideBarViewController?\n    \n    \n\n```\n\n\n## Add THSideBar to the view hierarchy\n\n```\n        self.sideBarViewController = THSideBarViewController()\n        addSubview(subView: (sideBarViewController?.view)!, toView: sourceView)\n        \n        sideBarViewController?.delegate = self\n        sideBarViewController?.allowDragAndDrop = false/true\n        sideBarViewController?.saveSection = false/true\n        setUpLayoutConstraints(item: sideBarViewController!.view, toItem: sourceView)\n        self.sideBarViewController!.view.setFrameSize( NSMakeSize(100, 200))\n```\n\n## Init data\n\n```\n        let item1 = Account(name:\"ContentView1\", icon:NSImage (named: NSImage.Name(rawValue: \"Human_resource\"))!, nameView: \"ContentView1Controller\", badge: \"10\", colorBadge: .blue)\n        let item2 = Account(name:\"ContentView2\", icon:NSImage (named: NSImage.Name(rawValue: \"Human_resource\"))!, nameView: \"ContentView2Controller\", badge: \"-5\", colorBadge: .red)\n        let item3 = Account(name:\"ContentView3\", icon:NSImage (named: NSImage.Name(rawValue: \"employee\"))!, nameView: \"ContentView3Controller\", badge: \"3\", colorBadge: .blue)\n        let item4 = Account(name:\"ContentView4\", icon:NSImage (named: NSImage.Name(rawValue: \"employee\"))!, nameView: \"ContentView4Controller\", badge: \"1\", colorBadge: .blue)\n        \n        account1.accounts.append(item1)\n        account1.accounts.append(item2)\n        account2.accounts.append(item3)\n        account2.accounts.append(item4)\n        \n        allSection.sections.removeAll()\n        allSection.sections.append(account1)\n        allSection.sections.append(account2)\n        allSection.dump()\n        sideBarViewController?.initData( allSection: allSection )\n    \n```\n\n## create all the viewController\n\n\n```\nextension MainWindowController: THSideBarViewDelegate\n{\n    func changeView(item : Item)\n    {\n        var  vc = NSView()\n                \n        if item.nameView == \"City\" {\n            \n            nameCity = item.name\n            NotificationCenter.send(.updateView)\n            return\n        }\n\n        switch item.nameView\n        {\n        case \"ContentView1Controller\":\n            vc = contentView1Controller.view\n            \n        case \"ContentView2Controller\":\n            vc = contentView2Controller.view\n            \n        case \"ContentView3Controller\":\n            vc = contentView3Controller.view\n            \n        case \"ContentView4Controller\":\n            vc = contentView4Controller.view\n            \n        case \"ContentView5Controller\":\n            vc = contentView5Controller.view\n            \n        case \"ContentView6Controller\":\n            vc = contentView6Controller.view\n            \n        case \"ContentView7Controller\":\n            vc = contentView7Controller.view\n            \n        default:\n            vc = contentView1Controller.view\n        }\n        \n        addSubview(subView: vc, toView: tableTargetView)\n        vc.translatesAutoresizingMaskIntoConstraints = false\n        \n        var viewBindingsDict = [String: AnyObject]()\n        viewBindingsDict[\"vc\"] = vc\n        tableTargetView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: \"H:|[vc]|\", options: [], metrics: nil, views: viewBindingsDict))\n        tableTargetView.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: \"V:|[vc]|\", options: [], metrics: nil, views: viewBindingsDict))\n    }\n\n```\n\n## Custom NSOutlineView\n\n    var isSaveSection = true                       // Ideal for dynamic sections\n    var colorBackGround = NSColor.blue\n    var rowSizeStyle = NSTableView.RowSizeStyle.small\n    var allowDragAndDrop = true\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthierryh91200%2Fthsidebar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthierryh91200%2Fthsidebar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthierryh91200%2Fthsidebar/lists"}