美文网首页Flutter
原生iOS工程引入Flutter

原生iOS工程引入Flutter

作者: yan0_0 | 来源:发表于2021-04-08 10:15 被阅读0次

    1.首先将flutter和原生项目放在同一级文件下面


    截屏2021-04-08 上午9.47.38.png

    2.接下来要在原生的oc工程中引入cocoapod来做管理,打开podfile文件

    flutter_application_path = '../flutter_community_ai'
    load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
    #source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
    platform :ios, '10.0'
    use_frameworks!
    
    target 'SevenBubble' do
    
    pod 'AFNetworking'
    pod "Qiniu", "~> 8.1"
    install_all_flutter_pods(flutter_application_path)
    end
    

    3.执行pod install命令,flutter就引入进来了


    截屏2021-04-08 上午10.11.40.png

    4.从原生跳转flutter页面
    引入头文件 import Flutter

    let flutterVC:FlutterViewController = FlutterViewController()
    flutterVC.hidesBottomBarWhenPushed = true
    self.navigationController?.pushViewController(flutterVC, animated: true)
    

    相关文章

      网友评论

        本文标题:原生iOS工程引入Flutter

        本文链接:https://www.haomeiwen.com/subject/cylmvktx.html