[GH-ISSUE #1734] [iOS] Create new Swift Package Manager for GDataXMLDocument #1729

Open
opened 2026-03-03 19:53:50 +03:00 by kerem · 0 comments
Owner

Originally created by @NghiaTranUIT on GitHub (Aug 10, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1734

Originally assigned to: @8bitzz on GitHub.

Description

It's error-prone to add GDataXML (Objective-C) code to the project when we have conflicts in the xcodeproject.

Thus, the .m is missing from the project without warning. It crashes the app TWICE time.

Acceptance Criteria

  • Bring this library to new SPM
  • Integrate into the app

How to do it

  1. Create an SPM with the name XMLParserSwift
  2. Add two objective-c files GDataXMLNode.h and GDataXMLNode.m
  3. Find a way to disable the ARC on file (GDataXMLNode.m) (ref: https://stackoverflow.com/questions/67803256/swift-package-manager-add-compile-flag-to-a-single-file-fno-objc-arc)

⚠️ GDataXMLNode.m requires -fno-objc-arc compile flag.

  1. Add a Swift struct into this SPM, name: XMLParserSwift.swift
  2. Add a static helper func:
static func prettyPrint(data: Data) -> String {
        guard let prettyXML = GDataXMLDocument.prettyPrintXMLData(data) else {
            return nil
        }
        return prettyXML
}
  1. Verify we can build the SPM without error
  2. Add this package to Proxyman iOS app
  3. In Proxyman iOS project, remove GDataXMLNode.h and GDataXMLNode.m because we don't need it anymore
  4. Open the class XMLParser and replace the old code with the new XMLParserSwift func.

How to test

  1. Use HTTPBot to make a POST request, body = XML file, Header: Content-Type: application/xml
  2. Open this request on Proxyman -> request -> Body -> Verify the app doesn't crash
Originally created by @NghiaTranUIT on GitHub (Aug 10, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1734 Originally assigned to: @8bitzz on GitHub. ## Description It's error-prone to add GDataXML (Objective-C) code to the project when we have conflicts in the `xcodeproject`. Thus, the `.m` is missing from the project without warning. It crashes the app TWICE time. ## Acceptance Criteria - Bring this library to new SPM - Integrate into the app ## How to do it 1. Create an SPM with the name `XMLParserSwift` 2. Add two objective-c files `GDataXMLNode.h` and `GDataXMLNode.m` 3. Find a way to disable the ARC on file (GDataXMLNode.m) (ref: https://stackoverflow.com/questions/67803256/swift-package-manager-add-compile-flag-to-a-single-file-fno-objc-arc) ⚠️ `GDataXMLNode.m` requires `-fno-objc-arc` compile flag. 4. Add a Swift struct into this SPM, name: `XMLParserSwift.swift` 5. Add a static helper func: ```swift static func prettyPrint(data: Data) -> String { guard let prettyXML = GDataXMLDocument.prettyPrintXMLData(data) else { return nil } return prettyXML } ``` 6. Verify we can build the SPM without error 7. Add this package to Proxyman iOS app 8. In Proxyman iOS project, remove `GDataXMLNode.h` and `GDataXMLNode.m` because we don't need it anymore 9. Open the class `XMLParser` and replace the old code with the new `XMLParserSwift` func. ### How to test 1. Use HTTPBot to make a POST request, body = XML file, Header: `Content-Type: application/xml` 2. Open this request on Proxyman -> request -> Body -> Verify the app doesn't crash
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1729
No description provided.