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

February 2018 Release #2845

Merged
merged 9 commits into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
30 changes: 16 additions & 14 deletions Frameworks/UIKit/NSLayoutConstraint.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "NSLayoutConstraint+AutoLayout.h"
#include "AutoLayout.h"

#include <regex>
#include <list>
#include <sstream>
#include <regex>
Expand Down Expand Up @@ -56,6 +55,8 @@
typedef vector<Constraint> ConstraintList;

bool parsePredicates(string line, PredicateList& predicates) {
static std::regex s_predicateRex{"^\\s*(==|>=|<=)?([\\w.]+)(@([\\w]+))?\\s*$"};

// Should this be parsed differently between connectors and constraints?
vector<string> predStr;

Expand All @@ -77,9 +78,8 @@ bool parsePredicates(string line, PredicateList& predicates) {
}

for (int i = 0; i < predStr.size(); i++) {
regex rex = regex::basic_regex("^\\s*(==|>=|<=)?([\\w.]+)(@([\\w]+))?\\s*$");
smatch m;
if (!regex_search(predStr[i], m, rex)) {
if (!regex_search(predStr[i], m, s_predicateRex)) {
TraceError(TAG, L"Syntax Error! %hs", predStr[i].c_str());
return false;
} else {
Expand Down Expand Up @@ -415,6 +415,15 @@ + (NSArray*)constraintsWithVisualFormat:(NSString*)format
options:(NSLayoutFormatOptions)opts
metrics:(NSDictionary*)metrics
views:(NSDictionary*)views {
// ([VH]:)
static std::regex s_vertizontalRex{"^([VH]:).*$"};
// Match all "]-(1,2,3)-["
static std::regex s_connectorRex{"(\\]|\\|)([^\\[]*)?(\\[|\\|)"};
// Match all "[one(>=two,three@4)]" or "|"
static std::regex s_constraintRex{"(\\[([^\\]]*)\\]|\\|)"};
// (sub-unit of a constraint)
static std::regex s_constraintPartRex{"^\\[([\\w]+)(\\(.*\\))?\\]$"};

UIView* superview = nil;
NSArray* items = views.allValues;

Expand Down Expand Up @@ -448,19 +457,15 @@ + (NSArray*)constraintsWithVisualFormat:(NSString*)format
ConstraintList constraints;

// Match constraint direction
// ([VH]:)
regex vertizontalRex = regex::basic_regex("^([VH]:).*$");
smatch vertizontalMatch;
if (regex_match(line, vertizontalMatch, vertizontalRex)) {
if (regex_match(line, vertizontalMatch, s_vertizontalRex)) {
if (vertizontalMatch[0].str()[0] == 'V') {
vertical = true;
}
line = line.substr(2);
}

// Match all "]-(1,2,3)-["
regex connectorRex = regex::basic_regex("(\\]|\\|)([^\\[]*)?(\\[|\\|)");
sregex_iterator connectorIt(line.begin(), line.end(), connectorRex);
sregex_iterator connectorIt(line.begin(), line.end(), s_connectorRex);
sregex_iterator end;

while (connectorIt != end) {
Expand Down Expand Up @@ -490,9 +495,7 @@ + (NSArray*)constraintsWithVisualFormat:(NSString*)format
connectorIt++;
}

// Match all "[one(>=two,three@4)]" or "|"
regex constraintRex = regex::basic_regex("(\\[([^\\]]*)\\]|\\|)");
sregex_iterator constraintIt(line.begin(), line.end(), constraintRex);
sregex_iterator constraintIt(line.begin(), line.end(), s_constraintRex);
size_t matchEnd = 0;

if (constraintIt->position() != 0) {
Expand All @@ -505,9 +508,8 @@ + (NSArray*)constraintsWithVisualFormat:(NSString*)format
#ifdef DEBUG_VISUAL_FORMAT
TraceVerbose(TAG, L"Constraint: %hs", conStr.c_str());
#endif
regex rex = regex::basic_regex("^\\[([\\w]+)(\\(.*\\))?\\]$");
smatch m;
if (!regex_search(conStr, m, rex)) {
if (!regex_search(conStr, m, s_constraintPartRex)) {
if (conStr == "|") {
constraints.push_back(Constraint(PredicateList(), conStr));
} else {
Expand Down
3 changes: 2 additions & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ branches:
is-release-branch: false
prevent-increment-of-merged-branch-version: true
ignore:
sha: []
sha:
- db05d76b7c9e9371f3edd8bb0085e260d1ad4957
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ When using the bridge, the first thing you'll want to do is generate a Visual St

For more detailed step by step instructions on how to import a project, see the [Quick Start Tutorial](https://github.com/Microsoft/WinObjC/wiki/Quick-Start-Tutorial) page of the wiki. For vsimporter options and known issues, check the [Using vsimporter](https://github.com/Microsoft/WinObjC/wiki/Using-vsimporter) wiki page.

### Analyzing your App
After importing your project, we strongly suggest using the [App Analysis Tool](https://developer.microsoft.com/en-us/windows/bridges/ios/app-analyzer-tool) to have a better understanding of the compatibility of your app with the bridge.

### Building & Running the Samples
A great way to learn more about the bridge and its features is building and running the samples of the SDK, which contain many code examples. We recommend starting with the **WOCCatalog** sample app, which demonstrates an assortment of iOS and XAML UI controls:

Expand All @@ -108,11 +105,10 @@ The following resources will help you get started. For more information, check o

1. [Wiki](https://github.com/Microsoft/WinObjC/wiki), for documentation and tutorials
2. [Development Roadmap](https://github.com/Microsoft/WinObjC/wiki/Roadmap), detailing our highest priorities
3. [App Analysis Tool](https://developer.microsoft.com/en-us/windows/bridges/ios/app-analyzer-tool), to evaluate the compatibility of your app with the bridge
4. [Website on Windows Dev Center](https://dev.windows.com/bridges/ios), for evaluation virtual machines
5. [Quick Start Challenge](https://github.com/Microsoft/WinObjC/wiki/Quick-Start-Tutorial), for a quick hands-on introduction to the bridge
7. [FAQ](https://github.com/Microsoft/WinObjC/wiki/FAQ), with common questions and issues
8. [The iOS Bridge Samples Repo](https://github.com/Microsoft/WinObjC-Samples), for sample apps and code using the bridge
3. [Website on Windows Dev Center](https://dev.windows.com/bridges/ios), for evaluation virtual machines
4. [Quick Start Challenge](https://github.com/Microsoft/WinObjC/wiki/Quick-Start-Tutorial), for a quick hands-on introduction to the bridge
5. [FAQ](https://github.com/Microsoft/WinObjC/wiki/FAQ), with common questions and issues
6. [The iOS Bridge Samples Repo](https://github.com/Microsoft/WinObjC-Samples), for sample apps and code using the bridge

## Contributing
There are many ways to contribute to the Windows Bridge for iOS:
Expand Down
25 changes: 25 additions & 0 deletions build/WinObjC.Frameworks.Core/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dependencies": {
"NuGet.Build.Packaging": "0.1.186"
},
"frameworks": {
".NETFramework,Version=v4.0": {
"imports": [
"dotnet",
"netstandard1.0",
"netstandard1.1",
"netstandard1.2",
"netstandard1.3",
"netstandard1.4",
"netstandard1.5",
"netstandard1.6",
"net20",
"net35",
"net40",
"native",
"monoandroid",
"xamarinios10"
]
}
}
}
25 changes: 25 additions & 0 deletions build/WinObjC.Frameworks.ThirdParty/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dependencies": {
"NuGet.Build.Packaging": "0.1.186"
},
"frameworks": {
".NETFramework,Version=v4.0": {
"imports": [
"dotnet",
"netstandard1.0",
"netstandard1.1",
"netstandard1.2",
"netstandard1.3",
"netstandard1.4",
"netstandard1.5",
"netstandard1.6",
"net20",
"net35",
"net40",
"native",
"monoandroid",
"xamarinios10"
]
}
}
}
25 changes: 25 additions & 0 deletions build/WinObjC.Frameworks.UWP.Core/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dependencies": {
"NuGet.Build.Packaging": "0.1.186"
},
"frameworks": {
".NETFramework,Version=v4.0": {
"imports": [
"dotnet",
"netstandard1.0",
"netstandard1.1",
"netstandard1.2",
"netstandard1.3",
"netstandard1.4",
"netstandard1.5",
"netstandard1.6",
"net20",
"net35",
"net40",
"native",
"monoandroid",
"xamarinios10"
]
}
}
}
25 changes: 25 additions & 0 deletions build/WinObjC.Frameworks.UWP/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dependencies": {
"NuGet.Build.Packaging": "0.1.186"
},
"frameworks": {
".NETFramework,Version=v4.0": {
"imports": [
"dotnet",
"netstandard1.0",
"netstandard1.1",
"netstandard1.2",
"netstandard1.3",
"netstandard1.4",
"netstandard1.5",
"netstandard1.6",
"net20",
"net35",
"net40",
"native",
"monoandroid",
"xamarinios10"
]
}
}
}
25 changes: 25 additions & 0 deletions build/WinObjC.Frameworks/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"dependencies": {
"NuGet.Build.Packaging": "0.1.186"
},
"frameworks": {
".NETFramework,Version=v4.0": {
"imports": [
"dotnet",
"netstandard1.0",
"netstandard1.1",
"netstandard1.2",
"netstandard1.3",
"netstandard1.4",
"netstandard1.5",
"netstandard1.6",
"net20",
"net35",
"net40",
"native",
"monoandroid",
"xamarinios10"
]
}
}
}
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Loading