aaron silva

aaron silva

1612344202

Become aware of the importance of White Label Crypto Exchange Development Services

Business firms looking to make it big in the fast-growing Cryptocurrency market can opt for readymade White label Crypto exchange development services instead of creating a trading platform from scratch.

The core features of a White Label Crypto Exchange are

  • Efficient fund management is ensured through integrated digital wallets and payment gateways.
  • Analytical dashboards contain interactive graphs and charts to enable better decision-making by the traders.
  • A live reporting module is present consisting of the latest information related to transactions, revenue, profits, and user activity.
  • It accepts multiple types of orders like a market order, limit order, and stop-loss order.
  • A robust admin panel assists in user management, adding new cryptos on the trading platform, and commission management.
  • The security measures include two-factor authentication, end-to-end data encryption, blacklist tracking, anti-DDoS protection, firewall implementation, and server hardening.

The process followed in launching a White Label Crypto Exchange

  • Analyzing the business requirements of the firm thoroughly.
  • Adding all the necessary features in the exchange.
  • Integrating the crypto tokens, coins, and different trading pairs.
  • Extensively testing the platform to eliminate all the technical bugs.
  • Setting up the exchange on the operational server.
  • Providing software upgrades, maintenance services, and technical support post-deployment.

With Bitcoin breaching the $41,000 mark recently, get hold of professional White label Crypto exchange development services and earn a lot of profits soon.

#cryptocurrency exchange script #white label exchange software #cryptocurrency exchange software #cryptocurrency exchange development

What is GEEK

Buddha Community

Become aware of the importance of White Label Crypto Exchange Development Services
Eva Watson

Eva Watson

1621420849

How to get the best crypto Exchange Development Services?

Antier Solutions is a globalized dynamic blockchain development company, assisting the clients with the finest Crypto Exchange Development Services in the market. Being one of the pioneers in the cryptocurrency exchange software development, we also offer instant White label cryptocurrency exchange platform, scalable according to the customer’s requirements, and simultaneously ensuring that the vital factors such as flexibility, transparency, security, controllability, and accuracy are met. We also have cybersecurity experts to protect your assets in the most efficient way possible.

For more information, call us: +91 98550 78699 (India), +1 (315) 825 4466 (US)
Email: info@antiersolutions.com

#crypto exchange development services #crypto exchange development #best crypto exchange development services #crypto exchange development company #antier solutions #crypto exchange development software

Rupert  Beatty

Rupert Beatty

1675797780

LLDebugtool: A Debugging Tool for Developers & Testers

LLDebugtool

A debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations.

Introduction

LLDebugTool is a debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations.

LLDebugToolSwift is the extension of LLDebugTool, it provide swift interface for LLDebugTool, LLDebugToolSwift will release with LLDebugTool at same time.

If your project is a Objective-C project, you can use LLDebugTool, if your project is a Swift project or contains swift files, you can use LLDebugToolSwift.

Choose LLDebugTool for your next project, or migrate over your existing projects—you'll be happy you did! 🎊🎊🎊

Gif

Preview

What's new in 1.3.8.1

Remove auto check version.

  • Too many visits to the website cocoadocs.org cause cocoadocs.org to disable the access to LLDebugTool, so this function is removed.

What can you do with LLDebugTool?

Always check the network request or view log information for certain events without having to run under XCode. This is useful in solving the testers' problems.

Easier filtering and filtering of useful information.

Easier analysis of occasional problems.

Easier analysis of the cause of the crash.

Easier sharing, previewing, or removing sandbox files, which can be very useful in the development stage.

Easier observe app's memory, CPU, FPS and other information.

Take screenshots, tag and share.

More intuitive view of view structure and dynamic modify properties.

Determine UI elements and colors in your App more accurately.

Easy access to and comparison of point information.

Easy access to element borders and frames.

Quick entry for html.

Mock location at anytime.

Adding LLDebugTool to your project

CocoaPods

CocoaPods is the recommended way to add LLDebugTool to your project.

Objective - C

  1. Add a pod entry for LLDebugTool to your Podfile pod 'LLDebugTool' , '~> 1.0'.
  2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugTool to your Podfile pod 'LLDebugTool' , '~> 1.0' ,:configurations => ['Debug'], Details also see Wiki/Use in Debug environment. If you want to specify the version, use as pod 'LLDebugTool' , '1.3.8.1' ,:configurations => ['Debug'].
  3. The recommended approach is to use multiple targets and only add pod 'LLDebugTool', '~> 1.0' to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if :configurations => ['Debug'], it can only run through XCode. It is not possible to Archive as an App).
  4. Install the pod(s) by running pod install. If you can't search LLDebugTool or you can't find the newest release version, running pod repo update before pod install.
  5. Include LLDebugTool wherever you need it with #import "LLDebug.h" or you can write #import "LLDebug.h" in your .pch in your .pch file.

Swift

  1. Add a pod entry for LLDebugToolSwift to your Podfile pod 'LLDebugToolSwift' , '~> 1.0'.
  2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugToolSwift to your Podfile pod 'LLDebugToolSwift' , '~> 1.0' ,:configurations => ['Debug'], Details also see Wiki/Use in Debug environment. If you want to specify the version, use as pod 'LLDebugToolSwift' , '1.3.8.1' ,:configurations => ['Debug'].
  3. The recommended approach is to use multiple targets and only add pod 'LLDebugToolSwift', '~> 1.0' to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if :configurations => ['Debug'], it can only run through XCode. It is not possible to Archive as an App).
  4. Must be added in the Podfile use_frameworks!.
  5. Install the pod(s) by running pod install. If you can't search LLDebugToolSwift or you can't find the newest release version, running pod repo update before pod install.
  6. Include LLDebugTool wherever you need it with import "LLDebugToolSwift.

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

Objective - C

To integrate LLDebugTool into your Xcode project using Carthage, specify it in your Cartfile:

github "LLDebugTool"

Run carthage to build the framework and drag the built LLDebugTool.framework into your Xcode project.

Swift

To integrate LLDebugToolSwift into your Xcode project using Carthage, specify it in your Cartfile:

github "LLDebugToolSwift"

Run carthage to build the framework and drag the built LLDebugToolSwift.framework into your Xcode project.

Source files

Alternatively you can directly add the source folder named LLDebugTool. to your project.

Objective - C

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop the source folder named LLDebugTool. When you are prompted to "Choose options for adding these files", be sure to check the "Copy items if needed".
  3. Integrated FMDB to your project,FMDB is an Objective-C wrapper around SQLite.
  4. Integrated Masonry to your project, Masonry is an Objective-C constraint library. There are no specific version requirements, but it is recommended that you use the latest version.
  5. Include LLDebugTool wherever you need it with #import "LLDebug.h" or you can write #import "LLDebug.h" in your .pch in your .pch file.

Swift

  1. Download the LLDebugTool latest code version or add the repository as a git submodule to your git-tracked project.
  2. Download the LLDebugToolSwift latest code version or add the repository as a git submodule to your git-tracked project.
  3. Open your project in Xcode, then drag and drop the source folder named LLDebugTool and LLDebugToolSwift. When you are prompted to "Choose options for adding these files", be sure to check the "Copy items if needed".
  4. Integrated FMDB to your project,FMDB is an Objective-C wrapper around SQLite.
  5. Integrated Masonry to your project, Masonry is an Objective-C constraint library. There are no specific version requirements, but it is recommended that you use the latest version.
  6. Include LLDebugTool wherever you need it with import LLDebugToolSwift".

Usage

Get Started

You need to start LLDebugTool at "application:(UIApplication * )application didFinishLaunchingWithOptions:(NSDictionary * )launchOptions", Otherwise you will lose some information.

If you want to configure some parameters, must configure before "startWorking". More config details see LLConfig.h.

  • Quick Start

In Objective-C

#import "AppDelegate.h"
#import "LLDebug.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // The default color configuration is green background and white text color. 

    // Start working.
    [[LLDebugTool sharedTool] startWorking];
    
    // Write your project code here.
    return YES;
}

In Swift

import LLDebugToolSwift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // ####################### Start LLDebugTool #######################//
        // Use this line to start working.
        LLDebugTool.shared().startWorking()
        
        // Write your project code here.
        
        return true
    }
  • Start With Custom Config

In Objective-C

#import "AppDelegate.h"
#import "LLDebug.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Start working with config.
    [[LLDebugTool sharedTool] startWorkingWithConfigBlock:^(LLConfig * _Nonnull config) {

        //####################### Color Style #######################//
        // Uncomment one of the following lines to change the color configuration.
        // config.colorStyle = LLConfigColorStyleSystem;
        // [config configBackgroundColor:[UIColor orangeColor] primaryColor:[UIColor whiteColor] statusBarStyle:UIStatusBarStyleDefault];

        //####################### User Identity #######################//
        // Use this line to tag user. More config please see "LLConfig.h".
        config.userIdentity = @"Miss L";

        //####################### Window Style #######################//
        // Uncomment one of the following lines to change the window style.
        // config.entryWindowStyle = LLConfigEntryWindowStyleNetBar;

    }];

    return YES;
}

In Swift

import LLDebugToolSwift

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        // Start working with config.
        LLDebugTool.shared().startWorking { (config) in
            //####################### Color Style #######################//
            // Uncomment one of the following lines to change the color configuration.
            // config.colorStyle = .system
            // config.configBackgroundColor(.orange, textColor: .white, statusBarStyle: .default)
        
            //####################### User Identity #######################//
            // Use this line to tag user. More config please see "LLConfig.h".
            config.userIdentity = "Miss L";
        
            //####################### Window Style #######################//
            // Uncomment one of the following lines to change the window style.
            // config.windowStyle = .netBar
        
            //####################### Features #######################//
            // Uncomment this line to change the available features.
            // config.availables = .noneAppInfo
        }
        
        return true
    }

Network Request

You don't need to do anything, just call the "startWorking" will monitoring most of network requests, including the use of NSURLSession, NSURLConnection and AFNetworking. If you find that you can't be monitored in some cases, please open an issue and tell me.

Log

Print and save a log. More log macros details see LLDebugToolMacros.h.

  • Save Log

In Objective-C

#import "LLDebug.h"

- (void)testNormalLog {
    // Insert an LLog where you want to print.
    LLog(@"Message you want to save or print.");
}

In Swift

import LLDebugToolSwift

    func testNormalLog() {
        // Insert an LLog where you want to print.
        LLog.log(message: "Message you want to save or print.")
    }
  • Save Log with event and level

In Objective-C

#import "LLDebug.h"

- (void)testEventErrorLog {
    // Insert an LLog_Error_Event where you want to print an event and level log.
    LLog_Error_Event(@"The event that you want to mark. such as bugA, taskB or processC.",@"Message you want to save or print.");
}

In Swift

import LLDebugToolSwift

    func testEventErrorLog() {
        // Insert an LLog_Error_Event where you want to print an event and level log.
        LLog.errorLog(message: "Message you want to save or print.", event: "The event that you want to mark. such as bugA, taskB or processC.")
    }

Crash

You don't need to do anything, just call the "startWorking" to intercept the crash, store crash information, cause and stack informations, and also store the network requests and log informations at the this time.

AppInfo

LLDebugTool monitors the app's CPU, memory, and FPS. At the same time, you can also quickly check the various information of the app.

Sandbox

LLDebugTool provides a quick way to view and manipulate sandbox, you can easily delete the files/folders inside the sandbox, or you can share files/folders by airdrop elsewhere. As long as apple supports this file format, you can preview the files directly in LLDebugTool.

Screenshots

LLDebugTool provides a screenshot and allows for simple painting and marking that can be easily recorded during testing or while the UI designers debugs the App.

Hierarchy

LLDebugTool provides a view structure tool for viewing or modify elements' properties and information in non-debug mode.

Magnifier

LLDebugTool provides a magnify tool for magnifying local uis and viewing color values at specified pixel.

Ruler

LLDebugTool provides a convenient tools to display touch point information.

Widget Border

LLDebugTool provides a function to display element border, convenient to see the view's frame.

HTML

LLDebugTool can debug HTML pages through WKWebView, UIWebView or your customized ViewController in your app at any time.

Location

LLDebugTool provides a function to mock location at anytime.

More Usage

  • You can get more help by looking at the Wiki.
  • You can download and run the LLDebugToolDemo or LLDebugToolSwiftDemo to find more use with LLDebugTool. The demo is build under MacOS 10.15.1, XCode 11.2.1, iOS 13.2.2, CocoaPods 1.8.4. If there is any version compatibility problem, please let me know.

Requirements

LLDebugTool works on iOS 8+ and requires ARC to build. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

UIKit

Foundation

SystemConfiguration

Photos

QuickLook

CoreTelephony

CoreLocation

MapKit

AVKit

Architecture

LLDebug.h

Public header file. You can refer it to the pch file.

DebugTool

LLDebugTool Used to start and stop LLDebugTool, you need to look at it.

LLConfig Used for the custom color , size , identification and other information. If you want to configure anything, you need to focus on this file.

LLDebugToolMacros.h Quick macro definition file.

Components

  • Network Used to monitoring network request.
  • Log Used to quick print and save log.
  • Crash Used to collect crash information when an App crashes.
  • AppInfo Use to monitoring app's properties.
  • Sandbox Used to view and operate sandbox files.
  • Screenshot Used to process and display screenshots.
  • Hierarchy Used to process and present the view structure.
  • Magnifier Used for magnifying glass function.
  • Ruler Used to ruler function.
  • Widget Border User to widget border function.
  • Function Used to show functions.
  • Html Used to dynamic test web view.
  • Location Used to mock location.
  • Setting Used to dynamically set configs.

Communication

  • If you need help, open an issue.
  • If you'd like to ask a general question, open an issue.
  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you find anything wrong or anything dislike, open an issue.
  • If you have some good ideas or some requests, send mail(llworkinggroup1992@gmail.com) to me.
  • If you want to contribute, submit a pull request.

Contact

Change-log

A brief summary of each LLDebugTool release can be found in the CHANGELOG.

点击查看中文简介

Download Details:

Author: HDB-Li
Source Code: https://github.com/HDB-Li/LLDebugTool 
License: View license

#swift #ios #cpu #monitoring #objective-c #xcode 

Akshara Singh

Akshara Singh

1615530305

White Label Crypto Exchange | Cryptocurrency Exchange Software Solutions

Cryptocurrencies are the talk of the city in recent days. The reason is - the growth of cryptocurrency is very especially the pride of cryptocurrencies bitcoin hit $50K, recently. So the crypto’s are made a massive impact in the trading world. And also this attracts many business class people to start an own crypto exchange business.

Every cryptopreneurs know using a white label crypto exchange software is one of the best & easiest ways to build a crypto exchange in a safe, secure & budget-friendly. But before buying a White Label Crypto Exchange Software, you need to consider some essential factors.

Things to Consider Before while a White Label Crypto Exchange Software:

  • Crypto Exchange Architecture
  • Graphical User Interface
  • Faster Deployment
  • Easy To Customize
  • Reliability
  • Liquidity
  • No Technical Expertise Required
  • Cryptocurrency Wallet Integration
  • Crypto Payment Gateway Integration & more.

These are the things that you need to consider while buying a white label crypto exchange software. Now your mind has this question “Where Can I Get the White label Crypto Exchange Software?” Don’t be nervous, I’ve done some technical groundwork to find out the best White Label Crypto Exchange Software Provider. As an end of the result, one white label crypto exchange software provider (Coinsclone) got my attention. I did some deep analysis about coinsclone, I got some information about them. They have a great number of experience in the crypto industry. Also, they have successfully delivered 100+ crypto exchange projects to their reputed clients. Their primary motto is customer satisfaction. So their crypto exchange script/Softwares are fully customized, secured, bug-free & inbuilt with advanced trading features.

If you are interested, you can check their free live demo @ White Label Crypto Exchange Software

in case, if you want to speak with their business experts directly. Then you can touch their experts via,

Whatsapp / Telegram @ +919500575285

Mail: hello@coinsclone.com

Skype: live:hello_20214

#white label crypto exchange software #white label crypto exchange #white label bitcoin exchange #white label bitcoin exchange software

坂本  篤司

坂本 篤司

1656981060

関数をC++からReactNativeにエクスポートする方法

今日も、ネイティブモジュールとC++での経験を共有し続けています。

多くのC/C ++ライブラリがモバイルプラットフォーム用に作成されているので、それらをiOSまたはReactNativeアプリケーションに実装する必要があります。そのため、関数をC++からReactNativeにエクスポートする方法についての記事を書きたいと思います。これは、理解しやすく、初心者の時間を節約できます。新しいreactネイティブアプリケーションから始めます

1.新しいreactネイティブアプリを作成し、ターミナルを開いて実行します

npx react-native init NativeModules

2. Xcodeを開き、NativeModules / ios/NativeModule.xcworkspaceに移動します

3.C++側での作業

新しいC++ファイルを作成し、名前を付けますCpp_to_RN.cpp

新しいC++ファイルを作成すると、XcodeはヘッダーファイルCpp_to_RN.hpp を作成します

まず、「Cpp_to_RN.hppファイルを開き、本体のない関数を含むクラスを作成します。

#ifndef Cpp_to_RN_hpp
#define Cpp_to_RN_hpp#include <stdio.h>
#include <string>class Cpp_to_RN {
public:
    std::string sayHello();
};#endif /* Cpp_to_RN_hpp */

次に、ファイルを開いてCpp_to_RN.cpp、単純な関数「sayHello()」を記述します。

#include "Cpp_to_RN.hpp"
std::string Cpp_to_RN::sayHello(){
    return "Hello from CPP";
}

4.C++ファイルのラッピングに取り組んでいます。

C ++ファイルをラップしてIOS(swift)側にエクスポートするには

a。ObjectiveCファイルを作成して名前を付けますCpp_to_RN.m

名前をに変更Cpp_to_RN.m します Cpp_to_RN.mm

b。ファイルを開き、C++ファイルからWrapCpp_to_RN.mm 関数をラップする本文のコンテンツを記述します。sayHello

#import <Foundation/Foundation.h>
#import "WrapCpp_to_RN.h"
#import "Cpp_to_RN.hpp"@implementation WrapCpp_to_RN- (NSString *) sayHello {
  Cpp_to_RN fromCPP;
    std::string helloWorldMessage = fromCPP.sayHello();
    return [NSString
            stringWithCString:helloWorldMessage.c_str()
            encoding:NSUTF8StringEncoding];
}
@end

c。ヘッダーファイルを作成し、名前を付けますWrapCpp_to_RN.h

wrapSayHello関数をSwiftファイルにエクスポートします

#import <Foundation/Foundation.h>
@interface WrapCpp_to_RN : NSObject
- (NSString *) wrapSayHello;
@end

5. iOS(Swift)側での作業

C++関数をReactNativeにエクスポートするには

a。Swiftファイルを作成し、名前を付けますSendCpp_to_RN.swift

注:Xcodeは、NativeModules-Bridging-Header.hファイルを作成するように要求します。

クラスSendCpp_to_RNを作成し、次のように宣言しますNSObject

#import <Foundation/Foundation.h>
@interface WrapCpp_to_RN : NSObject
- (NSString *) wrapSayHello;
@end

requiresMainQueueSetup()アプリケーション実行時の警告を防ぐ関数を作成する

#import <Foundation/Foundation.h>
@interface WrapCpp_to_RN : NSObject
- (NSString *) wrapSayHello;
@end

WrapCpp_to_RN()fromをラップする関数を記述しますWrapCpp_to_RN.mm

import Foundation@objc(SendCpp_to_RN)
class SendCpp_to_RN : NSObject {
    
  @objc static func requiresMainQueueSetup() -> Bool {
        return false
    }
  
  @objc func fromCpp(_ successCallback: RCTResponseSenderBlock) -> Void {
    successCallback([NSNull(), WrapCpp_to_RN().wrapSayHello() as Any])
    }}

b。Swiftファイルのラップ関数をReactNativeにエクスポートします

を使用してSwiftクラスとその関数をエクスポートするObjectiveCファイルを作成しますCallback

#import <React/RCTBridgeModule.h>
#import <Foundation/Foundation.h>
#import "UIKit/UIKit.h"
@interface RCT_EXTERN_MODULE(SendCpp_to_RN, NSObject)RCT_EXTERN_METHOD(fromCpp:(RCTResponseSenderBlock)successCallback)@end

c。SwiftをReactNativeに接続し、NativeModules-Bridging-Header.h ファイルを開きます

#import <React/RCTBridgeModule.h>#import <React/RCTViewManager.h>#import "WrapCpp_to_RN.h"

6.ReactNative側での作業

Swiftクラスとその関数を呼び出す

import React from 'react';
import {StyleSheet, Text, View, NativeModules, Button} from 'react-native';const App = () => {
  const onPress = () => {
    const {SendCpp_to_RN} = NativeModules;
    SendCpp_to_RN.fromCpp((_err, res) => console.log(res));
  };
  return (
    <View style={styles.container}>
      <Text> Practice !</Text>
      <Button title="C++ to React Native" color="#841584" onPress={onPress} />
    </View>
  );
};
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});
export default App;

これで完了です。アプリケーションを実行するだけです。

react-native run-ios

または、Xcodeの「実行」ボタンをクリックして、実行内容を確認してください。

私の記事がお役に立てば幸いです。お読みいただきありがとうございます。

 ソース:https ://betterprogramming.pub/native-modules-export-c-function-to-react-native-for-beginners-77e89934b210

#cpp #cplusplus #react 

Hoang  Ha

Hoang Ha

1656981000

Cách Xuất Một Hàm Từ C ++ Sang React Native

Hôm nay, tôi tiếp tục chia sẻ kinh nghiệm của mình với Native Module và C ++.

Vì chúng ta sẽ thấy rất nhiều thư viện C / C ++ viết cho nền tảng di động, chúng ta cần triển khai chúng cho ứng dụng iOS hoặc React Native của mình. Đó là lý do mình muốn viết một bài hướng dẫn cách export một hàm từ C ++ sang React Native dễ hiểu và tiết kiệm thời gian cho người mới bắt đầu. Tôi sẽ bắt đầu với một ứng dụng gốc phản ứng mới

1. Tạo một ứng dụng gốc phản ứng mới, mở thiết bị đầu cuối của bạn và chạy

npx react-native init NativeModules

2. Mở Xcode và điều hướng đến NativeModules / ios / NativeModule.xcworkspace

3. Làm việc trên C ++

Tạo một tệp C ++ mới và đặt tên cho nóCpp_to_RN.cpp

Khi chúng tôi tạo tệp C ++ mới, Xcode sẽ tạo tệp tiêu đề Cpp_to_RN.hpp cho chúng tôi

Đầu tiên, mở tệp Cpp_to_RN.hpp“” và tạo một lớp bao gồm một hàm không có phần thân.

#ifndef Cpp_to_RN_hpp
#define Cpp_to_RN_hpp#include <stdio.h>
#include <string>class Cpp_to_RN {
public:
    std::string sayHello();
};#endif /* Cpp_to_RN_hpp */

Sau đó, mở Cpp_to_RN.cpptệp và viết một hàm đơn giản “ sayHello()

#include "Cpp_to_RN.hpp"
std::string Cpp_to_RN::sayHello(){
    return "Hello from CPP";
}

4. Thao tác trên Wrapping C ++ file.

Để bọc các tệp C ++ và xuất chúng sang phía IOS (nhanh chóng)

một. Tạo một tệp Objective C và đặt tên cho nóCpp_to_RN.m

Đổi tên Cpp_to_RN.m thành Cpp_to_RN.mm

b. Mở WrapCpp_to_RN.mm tệp và viết nội dung phần nội dung sẽ bọc hàm sayHellotừ tệp C ++.

#import <Foundation/Foundation.h>
#import "WrapCpp_to_RN.h"
#import "Cpp_to_RN.hpp"@implementation WrapCpp_to_RN- (NSString *) sayHello {
  Cpp_to_RN fromCPP;
    std::string helloWorldMessage = fromCPP.sayHello();
    return [NSString
            stringWithCString:helloWorldMessage.c_str()
            encoding:NSUTF8StringEncoding];
}
@end

c. Tạo một tệp tiêu đề và đặt tên cho nóWrapCpp_to_RN.h

Xuất wrapSayHellohàm sang tệp Swift

#import <Foundation/Foundation.h>
@interface WrapCpp_to_RN : NSObject
- (NSString *) wrapSayHello;
@end

5. Làm việc trên iOS (Swift)

Để xuất hàm C ++ sang React Native

một. Tạo một tệp Swift và đặt tên cho nóSendCpp_to_RN.swift

Lưu ý: Xcode sẽ yêu cầu chúng tôi tạo một NativeModules-Bridging-Header.htệp cho chúng tôi.

Tạo một lớp SendCpp_to_RNvà khai báo nó làNSObject

#import <Foundation/Foundation.h>
@interface WrapCpp_to_RN : NSObject
- (NSString *) wrapSayHello;
@end

Viết một hàm requiresMainQueueSetup()để ngăn cảnh báo khi chúng tôi chạy ứng dụng

#import <Foundation/Foundation.h>
@interface WrapCpp_to_RN : NSObject
- (NSString *) wrapSayHello;
@end

Viết một hàm để bọc WrapCpp_to_RN()từWrapCpp_to_RN.mm

import Foundation@objc(SendCpp_to_RN)
class SendCpp_to_RN : NSObject {
    
  @objc static func requiresMainQueueSetup() -> Bool {
        return false
    }
  
  @objc func fromCpp(_ successCallback: RCTResponseSenderBlock) -> Void {
    successCallback([NSNull(), WrapCpp_to_RN().wrapSayHello() as Any])
    }}

b. Xuất một hàm bọc trong tệp Swift sang React Native

Tạo một tệp Objective C để xuất lớp Swift và chức năng của nó bằng cách sử dụngCallback

#import <React/RCTBridgeModule.h>
#import <Foundation/Foundation.h>
#import "UIKit/UIKit.h"
@interface RCT_EXTERN_MODULE(SendCpp_to_RN, NSObject)RCT_EXTERN_METHOD(fromCpp:(RCTResponseSenderBlock)successCallback)@end

c. Kết nối Swift với React Native, mở NativeModules-Bridging-Header.h tệp

#import <React/RCTBridgeModule.h>#import <React/RCTViewManager.h>#import "WrapCpp_to_RN.h"

6. Làm việc ở phía React Native

Gọi lớp Swift và các chức năng của nó

import React from 'react';
import {StyleSheet, Text, View, NativeModules, Button} from 'react-native';const App = () => {
  const onPress = () => {
    const {SendCpp_to_RN} = NativeModules;
    SendCpp_to_RN.fromCpp((_err, res) => console.log(res));
  };
  return (
    <View style={styles.container}>
      <Text> Practice !</Text>
      <Button title="C++ to React Native" color="#841584" onPress={onPress} />
    </View>
  );
};
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});
export default App;

Và chúng tôi đã hoàn tất, chỉ cần chạy ứng dụng

react-native run-ios

Hoặc chỉ cần nhấp vào nút “chạy” trên Xcode và xem những gì chúng tôi đã làm.

Tôi hy vọng bài viết của tôi hữu ích cho bạn, cảm ơn bạn đã dành thời gian đọc.

 Nguồn: https://betterprogramming.pub/native-modules-export-c- Chức năng-to-react-native-for-beginners-77e89934b210

#cpp #cplusplus #react