Convert to swift
740 2 2020-9-4
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_0wZiRVZwQQOj
lvl.2
Flight distance : 131860 ft
Israel
Offline

Hello,
i build camera app from this guide : https://developer.dji.com/mobile-sdk/documentation/ios-tutorials/index.html
and write averything in swift .
Can someone help to convert this to swift ?

[color=rgba(0, 0, 0, 0.85098)]-(void)videoFeedDJIVideoFeed *)videoFeed didUpdateVideoDataNSData *)videoData {
[color=rgba(0, 0, 0, 0.85098)]    [[DJIVideoPreviewer instance] pushuint8_t *)videoData.bytes lengthint)videoData.length];
[color=rgba(0, 0, 0, 0.85098)]}



when i convert this to swift like this :
[color=rgba(0, 0, 0, 0.85098)]func videoFeed(_ videoFeed: DJIVideoFeed, didUpdateVideoData videoData: Data) {
[color=rgba(0, 0, 0, 0.85098)]        DJIVideoPreviewer.instance().push(UInt8(videoData?.bytes ?? 0), length: (videoData?.count ?? 0))
[color=rgba(0, 0, 0, 0.85098)]    }


i got errors:


Cannot convert value of type 'UInt8' to expected argument type 'UnsafeMutablePointer<UInt8>?'

Cannot convert value of type 'UnsafeRawPointer' to expected argument type 'Int?'

Please help.

This is the stackoverflow : https://stackoverflow.com/questions/63739868/swift-convert-from-objc


2020-9-4
Use props
DJI_Lisa
lvl.4
United States
Offline

Can you try reposting your code without the formatting and emoticons?
Also, you may find what you need here in this Swift Sample: https://github.com/dji-sdk/Mobile-SDK-iOS/blob/798b8f2579cb08c643c18cd16b36cdfd3b0962f7/Sample%20Code/SwiftSampleCode/DJISDKSwiftDemo/Camera/VideoPreviewerAdapter.swift
2020-9-8
Use props
djiuser_0wZiRVZwQQOj
lvl.2
Flight distance : 131860 ft
Israel
Offline

This is working thanks.
2020-9-9
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules