Importing private submodule in swift file caused me error - objective-c

Here is the modulemap file :
framework module Framework
{
requires objc, objc_arc
umbrella header "Header.h"
export *
module * { export * }
explicit framework module Private
{
umbrella header "Header-Private.h"
}
}
how i imported it in swift file :
import Framework.Private
Now i've got this error :
#import Framework.Private; #import of module 'Framework.Private' in
implementation of 'Framework'; use #import

i think module map file will have some change
framework module <ProjectName> {
umbrella header "ProjectName.h"
export *
module * { export * }
explicit module ProjectName_Private {
private header “<headerName>.h”
link “staticLibName” // external static Library
export *
}
}

Related

Kotlin in VS Code - Unresolved reference for user defined class in another file

I'm trying to set up Kotlin for VS Code following the instructions in this article, which basically says to install the Kotlin and Code Runner extensions.
So far, so good, I am able to run the following code:
App.kt:
fun main() {
MyApp().printTest()
}
class MyApp {
fun printTest() {
println("Hello test")
}
}
However, when I try to extract the MyApp class to another file in the same folder, I can't import it:
App.kt:
import MyApp.MyApp // import MyApp doesn't work also
fun main() {
MyApp().printTest()
}
MyApp.kt:
class MyApp {
fun printTest() {
println("Hello test")
}
}
I've tried to import the Java Import Snippets extension, but it doesn't work, showing a unresolved reference for MyApp.
Am I missing some extension or VS Code configuration?
That's the command VS Code is running:
cd ".../testapp/src/" && kotlinc App.kt -include-runtime -d App.jar && java -jar App.jar
Should it reference MyApp.kt somehow?
Note: I'm on Debian.
You have no project's package name defined.
Put the files App.kt and MyApp.kt in the same folder level.
In App.kt, only use
import MyApp // or no import at all,
fun main() {
MyApp().printTest()
}
Read more about Java/Kotlin package

How to import whole SCSS folder in Vue Nuxt project?

At my company we are not writing css in Vue files, we prefer to do it the old way with SCSS.
Problem is, we end up with a need of writing new import in styles.scss any time we create new component, and it really bugs me in bigger projects.
Not so long ago, when I have been developing in React, I imported module called node-sass-glob-importer in webpack.config file, tweaked a bit (you can check here) and it worked - I could have imported folder like this: #import "components/**";
In Nuxt, I only have nuxt.config.js file and I am lost a bit. I know how to extend some simple stuff there, but this seems to be more complicated.
Any help of importing node-sass-glob-importer or doing the same thing in some other way?
how about using https://github.com/nuxt-community/style-resources-module and than:
export default {
modules: ['#nuxtjs/style-resources'],
styleResources: {
scss: [
'./assets/yourFolder/*.scss'
]
}
}
You can use node-sass-glob-importer in Nuxt like this:
nuxt.config.js:
const globImporter = require('node-sass-glob-importer');
export default {
...
css: [
'~/assets/scss/global.scss'
],
...
build: {
extend(config, {loaders: {scss}}) {
const sassOptions = scss.sassOptions || {};
sassOptions.importer = globImporter();
scss.sassOptions = sassOptions;
}
}
}
global.scss:
#import "./assets/scss/base/*";
#import "./assets/scss/components/*";
styleResources is used for things like variables, mixins and functions that you want to use anywhere in your SCSS without having to import the files.

Skeleton Plugin / Module Not found Issue after build

I created a plugin and I uploaded to NPM by using this skeleton. When I try to use it the module is not found:
import 'aurelia-virtual-scroll';
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-virtual-scroll');
My plugin index.js file looks like below:
export function configure(config) {
config.globalResources('./aurelia-virtual-scroll');
}
In the same folder I have that aurelia-virtual-scroll.js file.
The error I display is the one below:
Error: Cannot find module './aurelia-virtual-scroll/aurelia-virtual-scroll'.
at webpackContextResolve....
Should this happen? Am I missing something?
Here is my base code for the plugin.
And here is the skeleton for webpack where I am trying to use it
your class needs to be imported/exported in the index and you don't need to import it in the main file.
import { PLATFORM } from 'aurelia-pal';
export { AureliaVirtualScroll } from './aurelia-virtual-scroll';
export function configure(config) {
config.globalResources(PLATFORM.moduleName('./aurelia-virtual-scroll'));
}

How to use a swift module in an objective-c module with SwiftPM?

Here is an example of the root directory
├── Package.swift
└── Sources
├── Objc-cli
│   └── main.m
└── Swifty
└── MyStruct.swift
Where the Swifty module is just a simple struct
// MyStruct.swift
public struct MyStruct {
public var text = "Hello, World!"
public init() {
}
}
And in the Objc-cli I try to link the swift module like this.
// main.m
#import <Foundation/Foundation.h>
#import Swifty <---- Not found
int main() {
NSLog(#"Hello from Objc");
return 0;
}
Here is what the Package.swift looks like:
// Package.swift
import PackageDescription
let package = Package(
name: "MyTest",
targets: [
Target(name: "Swifty", dependencies: []),
Target(name: "Objc-cli", dependencies: ["Swifty"]),
]
)
Sadly the compiler doesn't recognise the Swifty module inside the objective-c module. Here is the output:
$ swift build
Compile Swift Module 'Swifty' (1 sources)
Compile Objc-cli main.m
/tmp/TestPackage/Sources/Objc-cli/main.m:10:9: fatal error: module 'Swifty' not found
#import Swifty
~~~~~~~^~~~~~
1 error generated.
<unknown>:0: error: build had 1 command failures
Have I missed something or is it simply impossible for now ?
Right now it's not possible to import Swift module in C module, it only works another way around, import C into Swift.
You can find detailed information at SwiftPM - C language targets

Using and deriving from interfaces defined in another COM library

I have two C++ COM projects in Visual Studio. In ProjectA I define InterfaceA in MIDL. In ProjectB I would like to define InterfaceB which inherits from InterfaceA. Is this possible to do without importing IDL or H files from ProjectA?
Here's how the code is laid out, which might be clearer. The libraries are large so I put things in separate files to make it easier to maintain.
Project A
InterfaceA.idl
import "oaidl.idl";
import "ocidl.idl";
[ uuid( ... ) ]
interface InterfaceA : IDispatch { ... }
CoclassA.idl
import "InterfaceA.idl";
[ uuid( ... ) ]
interface CoclassA
{
[default] interface InterfaceA;
};
ProjectA.idl
import "InterfaceA.idl";
[ uuid( ... ) ]
library ProjectA
{
interface InterfaceA;
#include "CoclassA.idl"
}
Project B
InterfaceB.idl
import "oaidl.idl";
import "ocidl.idl";
// If both interfaces were in the same project, I'd just import:
//import "InterfaceA.idl";
// Without the import I get a compilation error, obviously. I don't want to
// add ProjectA as an additional include directory because I don't want ProjectB
// to be dependent on how ProjectA's files are organized. I just want the types
// from ProjectA to be available here.
[ uuid(...) ]
interface InterfaceB: InterfaceA { ... }
CoclassB.idl
import "InterfaceB.idl";
[ uuid( ... ) ]
interface CoclassB
{
[default] interface InterfaceB;
};
ProjectB.idl
import "InterfaceB.idl";
[ uuid( ... ) ]
library ProjectB
{
// I wish using importlib would help here, but it won't since InterfaceB is
// defined and compiled by MIDL separately in InterfaceB.idl.
//importlib("ProjectA.tlb");
// I could try to #include "InterfaceB.idl", but then I would lose the
// automatic dependency analysis that MIDL does. I am also having trouble
// getting the MIDL compiler to understand #defines.
interface InterfaceB;
#include "CoclassB.idl"
}
I have a feeling that what I want to do is not possible. This wouldn't be a problem if MIDL supported an importlib equivalent outside of libraries!