How krystal1110/moview works
Project type and purpose
• It embeds the open-source Capstone C disassembly engine to render instruction listings.
File structure
• Top-level folders:
• MOView.xcodeproj – Xcode project file
• MOView/ – application source root
• – Assets.xcassets, ContentView.swift, MOViewApp.swift (entry point)
• – Tools/ – all parsing, conversion, file-I/O, and Capstone C code
• – Model/ – data models representing Mach-O headers, load commands, sections, modules
• – Views/ – SwiftUI view components (FileView, MachoView, ParseView, etc.)
• External/config files:
• Bridging header for mixing Swift and Obj-C/C (CapstoneHelper)
• .github/workflows/swiftLint.yml (linting pipeline)
Main components and their interactions
a. UI Layer (SwiftUI)
• MOViewApp.swift (App entry) → ContentView.swift → child views under Views/
• Presents file-open UI, module tree, section details, disassembly panes
b. Application Logic / Service Layer
• FileManager/File.swift – reads raw Mach-O file bytes
• MachO parsing: Tools/MachoTool.swift + MachO/Parse + MachO/Interpreter + LoadCommand classes → builds in-memory representations
• ConversionTools – transforms raw data into human-readable forms
• CapstoneHelper (Obj-C/Bridging) → Capstone C library under Tools/Capstone → provides instruction decoding
c. Model Layer
• Data structures under Tools/Model/MachoBaseModel and Tools/Model/Module → hold header, load command, section, symbol table, swift-metadata, etc.
d. External Dependency
• Capstone C library source tree (Tools/Capstone) compiled into the application via bridging headers
Architectural patterns & design principles
• MVVM-style separation (Views vs. underlying data models + service code)
• Modular layering: UI → Service → Model → External C library
• Clear boundaries and explicit bridging for C code
• Single process, in-memory data flow, no external server
– Presentation (SwiftUI Views)
– Application Services (FileManager, MachOTool, ConversionTools)
– Domain Model (MachoBaseModel, Module models)
– Native Engine (Capstone C library)
– External (Filesystem as data source)
– User → UI Layer (file-open action)
– UI → FileManager → raw bytes
– Raw bytes → MachOTool.parse() → Model instances
– Model data → ConversionTools (formatting)
– Views subscribe to Model → render lists
– For disassembly: Model.textSection → CapstoneHelper → Capstone Engine → decoded instructions → back to Views
c. Patterns:
– “MVVM-like” between Views and Model/Services
– “Bridging” boundary between Swift and C code
d. Label key technologies next to components:
– SwiftUI (Views)
– Swift (Tools, Model)
– Objective-C bridging (CapstoneHelper)
– C (Capstone disassembler)
– Green for data models
– Orange for bridging/interop
– Red for external C library
– Gray for filesystem