Using Foundation 5 with Hammer for Mac and Bourbon - zurb-foundation

I asked a similar question yesterday because of the amount of time Compass was taking to watch and compile my Sass files.
So, I pose this question. What is the ideal way to use a framework like Foundation 5, and still have the ability to update it in the future, while using Hammer for Mac for compiling and optimising my stylesheets and allows me to use the Bourbon mixins instead of Compass.
Any help is appreciated. Thanks in advance!

If you want to update Foundation in the future without any problems, you should follow rule: don't change files in foundation/components directory
all variables, that you need, you can find in foundation/settings.
some example of app.scss:
#import "bourbon";
#import "settings"; //where you can change all variables
#import "foundation"; //better
settings file look like:
https://github.com/zurb/foundation/blob/master/scss/foundation/_settings.scss

I arrange my styles as follows to ensure a clear separation:
styles/
app.scss
_settings.scss
external/
_bourbon.scss
_foundation5.scss
My externals folder above does not contain vendor CSS but is instead used for (selectively) importing vendor CSS located elsewhere in my project by using a sass load path.
I currently fetch vendor CSS using bower, therefore all my CSS lives in a bower_components/ folder at the root of my project. This way I can easily update to newer versions and there is a clear separation from what is vendor source and what is specific to my project.
I found I also had to resolve a few conflicts with bourbon and foundation as follows. I am currently using Bourbon 3.1.8 but experimented briefly with 3.2 (which doesn't yet compile with he current sass toolchain) hence the commented out lines specific to Bourbon 3.2:
// external/_bourbon.scss
// we comment out things that conflict with foundation styles
//#import "bower-bourbon/settings/prefixer"; // 3.2+ only
//#import "settings/px-to-em"; // 3.2+ only
// Custom Helpers
#import "bower-bourbon/helpers/deprecated-webkit-gradient"; // 3.1.8 only
#import "bower-bourbon/helpers/gradient-positions-parser";
#import "bower-bourbon/helpers/linear-positions-parser";
#import "bower-bourbon/helpers/radial-arg-parser";
#import "bower-bourbon/helpers/radial-positions-parser";
#import "bower-bourbon/helpers/render-gradients";
#import "bower-bourbon/helpers/shape-size-stripper";
// Custom Functions
//#import "bower-bourbon/functions/assin"; // 3.2+ only
#import "bower-bourbon/functions/compact"; // 3.1.8 only
//#import "bower-bourbon/functions/flex-grid"; // foundation conflict
//#import "bower-bourbon/functions/grid-width"; // foundation conflict
#import "bower-bourbon/functions/linear-gradient";
#import "bower-bourbon/functions/modular-scale";
#import "bower-bourbon/functions/px-to-em";
#import "bower-bourbon/functions/radial-gradient";
//#import "bower-bourbon/functions/strip-units"; // 3.2+ only
#import "bower-bourbon/functions/tint-shade";
#import "bower-bourbon/functions/transition-property-name";
//#import "bower-bourbon/functions/unpack"; // 3.2+ only
// CSS3 Mixins
#import "bower-bourbon/css3/animation";
#import "bower-bourbon/css3/appearance";
#import "bower-bourbon/css3/backface-visibility";
#import "bower-bourbon/css3/background";
#import "bower-bourbon/css3/background-image";
#import "bower-bourbon/css3/border-image";
#import "bower-bourbon/css3/border-radius";
//#import "bower-bourbon/css3/box-sizing"; // foundation conflict
//#import "bower-bourbon/css3/calc"; // 3.2+ only
//#import "bower-bourbon/css3/columns"; // foundation conflict
#import "bower-bourbon/css3/flex-box";
#import "bower-bourbon/css3/font-face";
//#import "bower-bourbon/css3/hyphens"; // 3.2+ only
#import "bower-bourbon/css3/hidpi-media-query";
#import "bower-bourbon/css3/image-rendering";
#import "bower-bourbon/css3/inline-block";
#import "bower-bourbon/css3/keyframes";
#import "bower-bourbon/css3/linear-gradient";
#import "bower-bourbon/css3/perspective";
#import "bower-bourbon/css3/radial-gradient";
#import "bower-bourbon/css3/transform";
#import "bower-bourbon/css3/transition";
#import "bower-bourbon/css3/user-select";
#import "bower-bourbon/css3/placeholder";
// Addons & other mixins
//#import "bower-bourbon/addons/button"; // foundation conflict
//#import "bower-bourbon/addons/clearfix"; // foundation conflict
#import "bower-bourbon/addons/font-family";
#import "bower-bourbon/addons/hide-text";
//#import "bower-bourbon/addons/directional-values"; // 3.2+ only
//#import "bower-bourbon/addons/ellipsis"; // 3.2+ only
#import "bower-bourbon/addons/html5-input-types";
#import "bower-bourbon/addons/position";
#import "bower-bourbon/addons/prefixer";
//#import "bower-bourbon/addons/rem"; // 3.2+ only
#import "bower-bourbon/addons/retina-image";
#import "bower-bourbon/addons/size";
#import "bower-bourbon/addons/timing-functions";
//#import "bower-bourbon/addons/triangle"; // foundation conflict
// Soon to be deprecated Mixins
#import "bower-bourbon/bourbon-deprecated-upcoming";
Importing foundation is just a one-liner currently but you could tweak it to only source what you need from foundation:
// external/_foundation5.scss
#import 'foundation/scss/foundation';

Related

Parsing issues - Opencv with Xcode

All of a sudden, I'm getting "Expected unqualified-id" and "Type name declared as a reference to a reference" parsing issues from importing opencv2/opencv.hpp I tried relinking opencv3, upgraded from opencv 3 to 4 and restarted Xcode. How can this be resolved?
Used prebuilt opencv from here: https://opencv.org/releases/ and Xcode 10.2
See All Parsing Errors
Expected unqualified-id:
CODE - Removed everything and left with this, but it still has parsing errors.
-------
.mm
------
#import <opencv2/opencv.hpp>
#import <opencv2/imgcodecs/ios.h>
#import <Foundation/Foundation.h>
#import "OpenCVWrapper3.h"
#include <vector>
using namespace std;
#implementation OpenCVWrapper3
+ (NSString *) openCVVersionString
{
return [NSString stringWithFormat:#"OpenCV Version %s", CV_VERSION];
}
#end
----
.h
----
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#interface OpenCVWrapper3 : NSObject
+ (NSString *) openCVVersionString;
#end
Ok so... I don't have a clue what caused the error. I opened another ios project that uses opencv and it gave the same errors. Then I created a new project and added #include iostream, ostream and got the same error. So its was not isolated to opencv. So I deleted and reinstalled Xcode and now it works!! Bizarre!

Using OpenCV inside IOS

I am trying to use the OpenCV library in my IOS application. I have installed it using pods and the current version is 2.4.13. Inside the PrefixHeader.pch file, I have included
#ifndef _cplusplus
#import <opencv2/opencv.hpp>
#endif
In my ViewController.m file, when I add the line #import "opencv2/highgui/ios.h", I get the build error
Parse Issue. Expected ')' ios.h.
This ios.h file is included in the library so I have not modified it and its contents:
#include "opencv2/core/core.hpp"
#import "opencv2/highgui/cap_ios.h"
UIImage* MatToUIImage(const cv::Mat& image);
void UIImageToMat(const UIImage* image,
cv::Mat& m, bool alphaExist = false);
According the documentation you need to change the *.m file to *.mm for newer XCode and IOS versions. Try renaming ViewController.m to ViewController.mm and see if that works.

#import generates incorrect TLH file

I am trying to create an stdafx.cpp file that includes all the #imports in a project to improve build time. I want to include all the imports for word/excel/ppt of office 2010, 2013 and 2016.
When I place all the imports in the CPP, there is no problem but when I place all the #imports in the stdafx.cpp. cx_excel2013.tlh is generated incorrectly.
The problem is that cx_excel2013.tlh is trying to use "Office2010" namespace for objects in "Office2013", which causes the build to fail.
for example, enum Office2010::MsoTriState LinkToFile is being generated which fails the build.
Can anyone explain what is going on or what is happening and how to overcome this (without returning the #imports back to the CPP)???
Also, I thought of just generating the TLH/TLI and remove the imports all together because they will not change, but it feels wrong and I don't solve the real problem.
Thanks!
STDAFX.CPP:
// Office 2010
#import "..\lib\tlb\office\MSO2010.tlb" rename_namespace("Office2010") rename("RGB","msoRGB") rename("SearchPath", "msoSearchPath") rename("DocumentProperties", "msoDocumentProperties")
#import "..\lib\tlb\office\VBE6EXT2010.tlb" rename_namespace("VBE6EXT2010") rename("Property", "vbeProperty")
#pragma warning(disable: 4192)
#import "..\lib\tlb\office\excel2010.tlb" rename_namespace("Excel2010") rename("VBE6", "VBE6EXT2010") rename("RGB","excelRGB") rename("DialogBox","excelDialogBox") rename("CopyFile","excelCopyFile") rename("ReplaceText","excelReplaceText") rename("Property", "excelProperty") no_function_mapping
#import "..\lib\tlb\office\msppt2010.tlb" rename_namespace("PowerPoint2010") rename("VBE6", "VBE6EXT2010") rename("RGB","pptRGB") rename("Property", "pptProperty") no_function_mapping
#import "..\lib\tlb\office\MSWORD2010.tlb" rename_namespace("Word2010") rename("VBE6", "VBE6EXT2010") rename("ExitWindows","wordExitWindows") rename("FindText","FindText1") rename("RGB", "wordRGB") no_function_mapping
#pragma warning(default: 4192)
// Office 2013
#import "..\lib\tlb\office\MSO2013.tlb" rename_namespace("Office2013") rename("RGB","msoRGB") rename("SearchPath", "msoSearchPath") rename("DocumentProperties", "msoDocumentProperties")
#import "..\lib\tlb\office\VBE6EXT2013.tlb" rename_namespace("VBE6EXT2013") rename("Property", "vbeProperty")
#pragma warning(disable: 4192)
#import "..\lib\tlb\office\excel2013.tlb" rename_namespace("Excel2013") rename("VBE6", "VBE6EXT2013") rename("RGB","excelRGB") rename("DialogBox","excelDialogBox") rename("CopyFile","excelCopyFile") rename("ReplaceText","excelReplaceText") rename("Property", "excelProperty") no_function_mapping
#import "..\lib\tlb\office\msppt2013.tlb" rename_namespace("PowerPoint2013") rename("VBE6", "VBE6EXT2013") rename("RGB","pptRGB") rename("Property", "pptProperty") no_function_mapping
#import "..\lib\tlb\office\MSWORD2013.tlb" rename_namespace("Word2013") rename("VBE6", "VBE6EXT2013") rename("ExitWindows","wordExitWindows") rename("FindText","FindText1") rename("RGB", "wordRGB") no_function_mapping
#pragma warning(default: 4192)
// Office 2016
#import "..\lib\tlb\office\MSO2016.tlb" rename_namespace("Office2016") rename("RGB","msoRGB") rename("SearchPath", "msoSearchPath") rename("DocumentProperties", "msoDocumentProperties")
#import "..\lib\tlb\office\VBE6EXT2016.tlb" rename_namespace("VBE6EXT2016") rename("Property", "vbeProperty")
#pragma warning(disable: 4192)
#import "..\lib\tlb\office\excel2016.tlb" rename_namespace("Excel2016") rename("VBE6", "VBE6EXT2016") rename("RGB","excelRGB") rename("DialogBox","excelDialogBox") rename("CopyFile","excelCopyFile") rename("ReplaceText","excelReplaceText") rename("Property", "excelProperty") no_function_mapping
#import "..\lib\tlb\office\msppt2016.tlb" rename_namespace("PowerPoint2016") rename("VBE6", "VBE6EXT2016") rename("RGB","pptRGB") rename("Property", "pptProperty") no_function_mapping
#import "..\lib\tlb\office\MSWORD2016.tlb" rename_namespace("Word2016") rename("VBE6", "VBE6EXT2016") rename("ExitWindows","wordExitWindows") rename("FindText","FindText1") rename("RGB", "wordRGB") no_function_mapping
#pragma warning(default: 4192)
EDIT:
I should add that the build fails and the other TLH/TLIs are not being generated.
The problem was that all office versions are using the same GUID, the only difference is the version, which the #import directive ignores.
That is why while constructing Excel2013.tlh/tli is using Office2010 (the first office TLB), because the GUID is it looking for is already defined so it can ignore Office2013. From VS point of view, it is the same one.
The interfaces are backward compatible, so the solution was just importing the 2016. The downside is that Office2010/2013 code can try to use code that it doesn't really support (fails in runtime).

Build fail when trying to use ObjectiveC code in Swift

I am trying to use one of my Objective-C class from another target, in my Swift class inside extension target.
I created the <Project-Name>-Bridging-Header.h and included that objective-c file, but the build is not compiling because of build error in "Cryptor.h" and <CommonCrypto/CommonDigest.h>. I believe this has to do something with CommonCrypto framework.
This is how my Bridging-Header.h looks:
#import <UIKit/UIKit.h>
#import <FacebookSDK/FacebookSDK.h>
#import <GooglePlus/GooglePlus.h>
#import <Security/Security.h>
#import <CommonCrypto/CommonCrypto.h>
#import <CommonCrypto/CommonDigest.h>
I guess this is due to Common Crypto library. Has anybody encountered the same issue and solved it?
EDIT:
Specifically, i am getting build error - "Missing #end" in CommonDigest.h and because CommonDigest.h is not getting build hence the error in Cryptor.h.
I don't know if it will fix your problem, but the bridge-header is sometimes a bit buggy. At least it was the case for me.
Try to edit your header and import your files like that:
#import "FacebookSDK.h"
#import "GooglePlus.h"
#import "Security.h"
#import "CommonCrypto.h"
#import "CommonDigest.h"
I have removed the UIKit-header, because you don't really need it, because swift has it's own UIKit.

Expected specifier-qualifier-list before

I have the following Objective-C headers:
// Menu.h
#import <UIKit/UIKit.h>
#import "GameController.h"
#interface Menu : UIImageView {
GameController *gameController; // "Expected specifier-qualifier-list
// before GameController"
}
- (void)appear;
#end
and
// GameController.h
#import <UIKit/UIKit.h>
#import "Menu.h"
#interface GameController : UIView {
Menu *menu; // "Unknown type name 'Menu'"
}
- (void)startLevel0;
- (void)startLevel1;
- (void)startLevel2;
#end
When I try to build the project, Xcode (v4) yells at me, saying Expected specifier-qualifier-list before GameController and unknown type name 'Menu'. I'm sure that they are somehow related, but I have no idea how?
It's not good practice to have mutually-including header files. Instead of importing Menu.h, use the #class directive. Try removing #import "Menu.h" and adding #class Menu in its place. Ditto for Menu.h (remove GameController include, and add the #class directive)
You have a circular reference in your imports. The compiler builds a dependency tree from the import statements so when two Classes rely on each other it doesn't know how to compile one before the other.
Sadly, gcc kicks out a fairly nonsensical error statement when this happens "Expected specifier-qualifier-list". #yan is correct that you should use the #class directive. Check out this question for a solid explanation: #class vs. #import