-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(pbxproj): deref root object to object collection
- Loading branch information
Showing
10 changed files
with
52 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use super::PBXObject; | ||
use std::collections::HashMap; | ||
|
||
/// [`PBXObject`] storage with convenient helper methods | ||
#[derive(Debug, derive_new::new, derive_deref_rs::Deref)] | ||
pub struct PBXObjectCollection(HashMap<String, PBXObject>); | ||
|
||
impl PBXObjectCollection { | ||
/// Get PBXTarget by the target name | ||
pub fn get_target_by_name(&self, target_name: &str) -> Option<(&String, &PBXObject)> { | ||
self.0.iter().find(|(_, o)| { | ||
let target = match o { | ||
PBXObject::PBXAggregateTarget(ref v) => &v.inner, | ||
PBXObject::PBXLegacyTarget(ref v) => &v.inner, | ||
PBXObject::PBXNativeTarget(ref v) => &v.inner, | ||
_ => return false, | ||
}; | ||
if let Some(name) = target.name.as_ref() { | ||
name == target_name | ||
} else { | ||
false | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters