How jamf/jamf-switcher works
Main Components
• User Interface (UI) Layer:
• This includes the storyboard (Main.storyboard), AppDelegate.swift, ViewController.swift, and any other UI-specific assets.
• It handles user interactions, such as selecting bookmarks, search queries (CMD + F), and double-clicking to trigger app selection.
• API/Logic Layer:
• Resolve functionality provided in the JamfAPI directory. Within JamfAPI, separate concerns are evident:
▪ API: Handles calls to Jamf API endpoints (CallAPI.swift, JamfAPI.swift).
▪ Logic: Encapsulated business logic for Jamf operations (JamfLogic.swift).
▪ Models: Data structures that represent Jamf information (Structures.swift).
▪ Service: Implements service layer tasks (JamfService.swift).
• Self Service & Bookmark Processing:
• JamfSelfServiceParser.swift parses self-service bookmark data that is configured within Jamf Pro.
• System Integration & Keychain:
• KeychainService.swift likely handles secure storage or retrieval of credentials/settings.
• Configuration & External Interactions:
• The app makes changes to the system’s ~/Library/Preferences/com.jamfsoftware.jss.plist based on user actions.
• There’s logic in PolicyLogic.swift (under Jamf Switcher/Logic) that might deal with decision-making and policy operations.
Out Relationships and Interactions
• The UI Layer presents the list of Jamf bookmarks to the user and captures actions (e.g., selecting a bookmark or executing a search).
• On user action, the UI layer delegates work to the Business Logic/Policy layer (PolicyLogic.swift) and to the API/Service layer for handling network requests or local updates.
• The API/Logic Layer processes user requests by calling APIs, managing models, and executing business logic.
• When the target Jamf Pro application needs to be launched, the app accesses external applications (e.g., checking for /Applications/Jamf Pro/ folder) and modifies configuration files accordingly.
• The KeychainService may be used by various layers to securely store or fetch credentials if needed.
Architectural Patterns and Design Principles
• Separation of Concerns: The project neatly divides the UI (Storyboards, controllers) from business logic (JamfAPI’s subdirectories) and from system integration (Keychain, Preference modifications).
• Modular Design: The use of directories like API, Logic, Models, and Service indicates a modular structure that helps extensibility and maintenance.
Relevant Technologies, Frameworks, and Tools
• Swift as the primary programming language and Xcode as the development environment.
• Cocoa frameworks for macOS user interface components.
• Xcode project configuration files (Jamf Switcher.xcodeproj) that outline the build and project settings.
• External dependencies: Although not explicitly mentioned as third-party libraries in the file tree, note that self-service bookmark configuration and the system preference file integration imply usage of macOS system APIs.
Elements
• Each Component Label:
• “UI Layer” – Main.storyboard, ViewController, AppDelegate.
• “Business Logic” – PolicyLogic, JamfAPI’s Logic and Models.
• “API/Service Layer” – JamfAPI/API, JamfService.
• “System Integration” – KeychainService, Preference updates at ~/Library/Preferences/com.jamfsoftware.jss.plist.
• Data flow: UI actions → Business Logic → Service/API calls → System-level actions.
• Differentiation of Components:
Detail and Structure
• Even though the project isn’t vast in component count, decompose it enough to see clear boundaries between functionality. This separation helps when revisiting integration points (like how the Jamf Self Service bookmarks feed into the app logic or trigger external actions).