ProxymanApp / ProxymanApp/Proxyman

[iOS] Create new Swift Package Manager for GDataXMLDocument

Open
#1,734 0 comments 0 reactions 1 assignee View on GitHub

@8bitzz is already working on this.

Since Aug 10, 2023.

✅ Done enhancement
Dominant language
No language data
Stars
7k
Forks
237
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.