Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review optionality of attributes #107

Merged
merged 18 commits into from
Oct 13, 2017
Merged

Review optionality of attributes #107

merged 18 commits into from
Oct 13, 2017

Conversation

pepicrft
Copy link
Contributor

@pepicrft pepicrft commented Oct 10, 2017

Resolves #101

Short description 📝

Review which attributes should be optional or not.

Solution 📦

For each attribute, I remove it from the object and try to open the project with Xcode. If Xcode can handle not having the value, then the attribute is optional, if the project is considered invalid by Xcode, then the attribute is required.

Implementation

  • PBXAggregateTarget
  • PBXBuildFile
  • PBXBuildPhase
  • PBXContainerItemProxy
  • PBXCopyFilesBuildPhase
  • PBXFileElement
  • PBXFileReference
  • PBXFrameworksBuildPhase
  • PBXGroup
  • PBXHeadersBuildPhase
  • PBXNativeTarget
  • PBXObject
  • PBXProj
  • PBXReferenceProxy
  • PBXResourcesBuildPhase
  • PBXShellScriptBuildPhase
  • PBXSourcesBuildPhase
  • PBXTarget
  • PBXTargetDependency
  • PBXVariantGroup
  • XCBuildConfiguration
  • XCConfigurationList
  • XCScheme
  • XCSharedData
  • XCVersionGroup
  • XCWorkspaceData

GIF

gif

@pepicrft pepicrft changed the title Review optionality of attributes [WIP] Review optionality of attributes Oct 10, 2017
@pepicrft pepicrft self-assigned this Oct 10, 2017
@pepicrft pepicrft requested a review from a team October 10, 2017 14:50
@pepicrft pepicrft added this to the 0.5.0 milestone Oct 10, 2017
Copy link
Contributor

@esttorhe esttorhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!
Amazing job as always Pedro

@@ -14,7 +14,7 @@ public class PBXBuildPhase: PBXObject {

public init(reference: String,
files: [String] = [],
buildActionMask: UInt = 2147483647,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!! No more magic ✨ numbers!

@pepicrft pepicrft modified the milestones: 0.4.1, 0.5.0 Oct 12, 2017
@pepicrft pepicrft force-pushed the review-optionals branch 2 times, most recently from 983ab18 to 65337f0 Compare October 13, 2017 06:44
let proxyTypeString: String = try container.decode(.proxyType)
self.proxyType = UInt(proxyTypeString).flatMap({ProxyType(rawValue: $0)}) ?? .other
self.remoteGlobalIDString = try container.decode(.remoteGlobalIDString)
let proxyTypeString: String? = try container.decodeIfPresent(.proxyType)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed when the decoding changes happened there are a whole bunch of these cases where something is decoded into a string and then flatMaped into a UInt. Is there a specific reason for that, as opposed to decoding directly to a UInt?

Copy link
Collaborator

@yonaskolb yonaskolb Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this not work?

self.proxyType = try container.decodeIfPresent(UInt.self, forKey: .proxyType).flatMap(ProxyType.init) ?? .other

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the decoder throws because doesn't know how to convert those values into integers @yonaskolb

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, makes sense

@pepicrft pepicrft changed the title [WIP] Review optionality of attributes Review optionality of attributes Oct 13, 2017
@pepicrft pepicrft merged commit 0dab4ec into master Oct 13, 2017
@pepicrft pepicrft deleted the review-optionals branch October 13, 2017 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants