Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(ios) rewrite ViewController in Swift
Saúl Ibarra Corretgé95a0a8418f44
diff --git a/ios/app/app.xcodeproj/project.pbxproj b/ios/app/app.xcodeproj/project.pbxprojindex c4f710838c..31d9cc6eed 100644--- a/ios/app/app.xcodeproj/project.pbxproj+++ b/ios/app/app.xcodeproj/project.pbxproj@@ -7,7 +7,6 @@objects = {/* Begin PBXBuildFile section */- 0B412F1F1EDEE6E800B1A0A6 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */; };0B5418471F7C5D8C00A2DD86 /* MeetingRowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B5418461F7C5D8C00A2DD86 /* MeetingRowController.swift */; };0B7001701F7C51CC005944F4 /* InCallController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B70016F1F7C51CC005944F4 /* InCallController.swift */; };0BEA5C291F7B8F73000D0AB4 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0BEA5C271F7B8F73000D0AB4 /* Interface.storyboard */; };@@ -34,6 +33,7 @@4EB0603D260E09D000F524C5 /* DarwinNotificationCenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB0603A260E09D000F524C5 /* DarwinNotificationCenter.swift */; };4EB0603E260E09D000F524C5 /* SampleUploader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EB0603B260E09D000F524C5 /* SampleUploader.swift */; };DE4C456121DE1E4E00EA0709 /* FIRUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = DE4C455F21DE1E4E00EA0709 /* FIRUtilities.m */; };+ DEA0B7122D7EF16E0062A9F6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEA0B7112D7EF16E0062A9F6 /* ViewController.swift */; };DEA9F289258A6EA800D4CD74 /* JitsiMeetSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEA9F288258A6EA800D4CD74 /* JitsiMeetSDK.framework */; };DEA9F28A258A6EA800D4CD74 /* JitsiMeetSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DEA9F288258A6EA800D4CD74 /* JitsiMeetSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };DED016F128ECBC9D009D5E8D /* WebRTC.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DED016F028ECBC9D009D5E8D /* WebRTC.xcframework */; };@@ -120,8 +120,6 @@/* Begin PBXFileReference section */0B26BE6D1EC5BC3C00EEFB41 /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };- 0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };- 0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };0B5418461F7C5D8C00A2DD86 /* MeetingRowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingRowController.swift; sourceTree = "<group>"; };0B70016F1F7C51CC005944F4 /* InCallController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InCallController.swift; sourceTree = "<group>"; };0BBD021F212EB69D00CCB19F /* Types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Types.h; sourceTree = "<group>"; };@@ -161,6 +159,8 @@DE050388256E904600DEE3A5 /* WebRTC.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = WebRTC.xcframework; path = "../../node_modules/react-native-webrtc/apple/WebRTC.xcframework"; sourceTree = "<group>"; };DE4C455F21DE1E4E00EA0709 /* FIRUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRUtilities.m; sourceTree = "<group>"; };DE4C456021DE1E4E00EA0709 /* FIRUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIRUtilities.h; sourceTree = "<group>"; };+ DEA0B7102D7EF16D0062A9F6 /* JitsiMeet-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeet-Bridging-Header.h"; sourceTree = "<group>"; };+ DEA0B7112D7EF16E0062A9F6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };DEA9F288258A6EA800D4CD74 /* JitsiMeetSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JitsiMeetSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; };DED016F028ECBC9D009D5E8D /* WebRTC.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = WebRTC.xcframework; path = ../Pods/JitsiWebRTC/WebRTC.xcframework; sourceTree = "<group>"; };DEFDBBDB25656E3B00344B23 /* WebRTC.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = WebRTC.xcframework; path = "../../node_modules/react-native-webrtc/ios/WebRTC.xcframework"; sourceTree = "<group>"; };@@ -264,8 +264,8 @@13B07FB11A68108700A75B9A /* LaunchScreen.xib */,13B07FB71A68108700A75B9A /* main.m */,0BBD021F212EB69D00CCB19F /* Types.h */,- 0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */,- 0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */,+ DEA0B7112D7EF16E0062A9F6 /* ViewController.swift */,+ DEA0B7102D7EF16D0062A9F6 /* JitsiMeet-Bridging-Header.h */,);path = src;sourceTree = "<group>";@@ -430,6 +430,7 @@ProvisioningStyle = Automatic;};13B07F861A680F5B00A75B9A = {+ LastSwiftMigration = 1620;SystemCapabilities = {com.apple.SafariKeychain = {enabled = 1;@@ -654,8 +655,8 @@isa = PBXSourcesBuildPhase;buildActionMask = 2147483647;files = (- 0B412F1F1EDEE6E800B1A0A6 /* ViewController.m in Sources */,13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,+ DEA0B7122D7EF16E0062A9F6 /* ViewController.swift in Sources */,DE4C456121DE1E4E00EA0709 /* FIRUtilities.m in Sources */,13B07FC11A68108700A75B9A /* main.m in Sources */,);@@ -863,6 +864,7 @@buildSettings = {ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;ASSETCATALOG_COMPILER_APPICON_NAME = AppIconDebug;+ CLANG_ENABLE_MODULES = YES;CODE_SIGN_ENTITLEMENTS = app.entitlements;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;@@ -887,6 +889,9 @@SUPPORTS_MACCATALYST = NO;SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;+ SWIFT_OBJC_BRIDGING_HEADER = "src/JitsiMeet-Bridging-Header.h";+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";+ SWIFT_VERSION = 6.0;TARGETED_DEVICE_FAMILY = "1,2";};name = Debug;@@ -897,6 +902,7 @@buildSettings = {ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;ASSETCATALOG_COMPILER_APPICON_NAME = AppIconRelease;+ CLANG_ENABLE_MODULES = YES;CODE_SIGN_ENTITLEMENTS = app.entitlements;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;@@ -920,6 +926,8 @@SUPPORTS_MACCATALYST = NO;SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;+ SWIFT_OBJC_BRIDGING_HEADER = "src/JitsiMeet-Bridging-Header.h";+ SWIFT_VERSION = 6.0;TARGETED_DEVICE_FAMILY = "1,2";};name = Release;diff --git a/ios/app/src/AppDelegate.m b/ios/app/src/AppDelegate.mindex d1cbc5d092..a2a8bf8b66 100644--- a/ios/app/src/AppDelegate.m+++ b/ios/app/src/AppDelegate.m@@ -18,7 +18,7 @@#import "AppDelegate.h"#import "FIRUtilities.h"#import "Types.h"-#import "ViewController.h"+#import "jitsi_meet-Swift.h"@import Firebase;@import JitsiMeetSDK;@@ -65,7 +65,7 @@[jitsiMeet showSplashScreen:vc.view];[self.window makeKeyAndVisible];-+return YES;}diff --git a/ios/app/src/JitsiMeet-Bridging-Header.h b/ios/app/src/JitsiMeet-Bridging-Header.hnew file mode 100644index 0000000000..1b2cb5d6d0--- /dev/null+++ b/ios/app/src/JitsiMeet-Bridging-Header.h@@ -0,0 +1,4 @@+//+// Use this file to import your target's public headers that you would like to expose to Swift.+//+diff --git a/ios/app/src/ViewController.h b/ios/app/src/ViewController.hdeleted file mode 100644index 1b1d967fd6..0000000000--- a/ios/app/src/ViewController.h+++ /dev/null@@ -1,24 +0,0 @@-/*- * Copyright @ 2017-present Atlassian Pty Ltd- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--@import UIKit;-@import JitsiMeetSDK;--@interface ViewController : UIViewController<JitsiMeetViewDelegate>--- (void)terminate;--@enddiff --git a/ios/app/src/ViewController.m b/ios/app/src/ViewController.mdeleted file mode 100644index 09bcb66b4b..0000000000--- a/ios/app/src/ViewController.m+++ /dev/null@@ -1,163 +0,0 @@-/*- * Copyright @ 2017-present 8x8, Inc.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--@import CoreSpotlight;-@import MobileCoreServices;-@import Intents; // Needed for NSUserActivity suggestedInvocationPhrase--@import JitsiMeetSDK;--#import "Types.h"-#import "ViewController.h"---@implementation ViewController--- (void)loadView {- JitsiMeetView *jitsiView = [[JitsiMeetView alloc] initWithFrame:[UIScreen mainScreen].bounds];-- self.view = jitsiView;-}--- (void)viewDidLoad {- [super viewDidLoad];-- JitsiMeetView *view = (JitsiMeetView *) self.view;- view.delegate = self;-- [view join:[[JitsiMeet sharedInstance] getInitialConferenceOptions]];-}--// JitsiMeetViewDelegate--- (void)_onJitsiMeetViewDelegateEvent:(NSString *)name- withData:(NSDictionary *)data {- NSLog(- @"[%s:%d] JitsiMeetViewDelegate %@ %@",- __FILE__, __LINE__, name, data);--#if DEBUG- NSAssert(- [NSThread isMainThread],- @"JitsiMeetViewDelegate %@ method invoked on a non-main thread",- name);-#endif-}--- (void)conferenceJoined:(NSDictionary *)data {- [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_JOINED" withData:data];-- // Register a NSUserActivity for this conference so it can be invoked as a- // Siri shortcut.- NSUserActivity *userActivity- = [[NSUserActivity alloc] initWithActivityType:JitsiMeetConferenceActivityType];-- NSString *urlStr = data[@"url"];- NSURL *url = [NSURL URLWithString:urlStr];- NSString *conference = [url.pathComponents lastObject];-- userActivity.title = [NSString stringWithFormat:@"Join %@", conference];- userActivity.suggestedInvocationPhrase = @"Join my Jitsi meeting";- userActivity.userInfo = @{@"url": urlStr};- [userActivity setEligibleForSearch:YES];- [userActivity setEligibleForPrediction:YES];- [userActivity setPersistentIdentifier:urlStr];-- // Subtitle- CSSearchableItemAttributeSet *attributes- = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeItem];- attributes.contentDescription = urlStr;- userActivity.contentAttributeSet = attributes;-- self.userActivity = userActivity;- [userActivity becomeCurrent];-}--- (void)conferenceTerminated:(NSDictionary *)data {- [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_TERMINATED" withData:data];-}--// - (void)conferenceUniqueIdSet:(NSDictionary *)data {-// [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_UNIQUE_ID_SET" withData:data];-// }--- (void)conferenceWillJoin:(NSDictionary *)data {- [self _onJitsiMeetViewDelegateEvent:@"CONFERENCE_WILL_JOIN" withData:data];-}--// - (void)customButtonPressed:(NSDictionary *)data {-// [self _onJitsiMeetViewDelegateEvent:@"CUSTOM_BUTTON_PRESSED" withData:data];-// }--#if 0-- (void)enterPictureInPicture:(NSDictionary *)data {- [self _onJitsiMeetViewDelegateEvent:@"ENTER_PICTURE_IN_PICTURE" withData:data];-}-#endif--- (void)readyToClose:(NSDictionary *)data {- [self _onJitsiMeetViewDelegateEvent:@"READY_TO_CLOSE" withData:data];-}--// - (void)recordingStatusChanged:(NSDictionary *)data {-// [self _onJitsiMeetViewDelegateEvent:@"RECORDING_STATUS_CHANGED" withData:data];-// }--// - (void)transcriptionChunkReceived:(NSDictionary *)data {-// [self _onJitsiMeetViewDelegateEvent:@"TRANSCRIPTION_CHUNK_RECEIVED" withData:data];-// }--- (void)participantJoined:(NSDictionary *)data {- NSLog(@"%@%@", @"Participant joined: ", data[@"participantId"]);-}--- (void)participantLeft:(NSDictionary *)data {- NSLog(@"%@%@", @"Participant left: ", data[@"participantId"]);-}--- (void)audioMutedChanged:(NSDictionary *)data {- NSLog(@"%@%@", @"Audio muted changed: ", data[@"muted"]);-}--- (void)endpointTextMessageReceived:(NSDictionary *)data {- NSLog(@"%@%@", @"Endpoint text message received: ", data);-}--- (void)screenShareToggled:(NSDictionary *)data {- NSLog(@"%@%@", @"Screen share toggled: ", data);-}--- (void)chatMessageReceived:(NSDictionary *)data {- NSLog(@"%@%@", @"Chat message received: ", data);-}--- (void)chatToggled:(NSDictionary *)data {- NSLog(@"%@%@", @"Chat toggled: ", data);-}--- (void)videoMutedChanged:(NSDictionary *)data {- NSLog(@"%@%@", @"Video muted changed: ", data[@"muted"]);-}---#pragma mark - Helpers--- (void)terminate {- JitsiMeetView *view = (JitsiMeetView *) self.view;- [view leave];-}--@enddiff --git a/ios/app/src/ViewController.swift b/ios/app/src/ViewController.swiftnew file mode 100644index 0000000000..7cda6258a9--- /dev/null+++ b/ios/app/src/ViewController.swift@@ -0,0 +1,94 @@+/*+ * Copyright @ 2025-present 8x8, Inc.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * http://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */++import CoreSpotlight+import Intents+import MobileCoreServices+import UIKit++import JitsiMeetSDK++@objcMembers+class ViewController: UIViewController {++ override func loadView() {+ let jitsiView = JitsiMeetView(frame: UIScreen.main.bounds)+ self.view = jitsiView+ }++ override func viewDidLoad() {+ super.viewDidLoad()++ guard let view = self.view as? JitsiMeetView else { return }+ view.delegate = self+ view.join(JitsiMeet.sharedInstance().getInitialConferenceOptions())+ }++ // MARK: - Helper Methods++ func terminate() {+ guard let view = self.view as? JitsiMeetView else { return }+ view.leave()+ }+}+++extension ViewController: @preconcurrency JitsiMeetViewDelegate {++ // MARK: - Private Helper Methods++ private func onJitsiMeetViewDelegateEvent(_ name: String, withData data: [AnyHashable: Any]?) {+ NSLog("[%@:%d] JitsiMeetViewDelegate %@ %@", #file, #line, name, data ?? [:])++ #if DEBUG+ assert(Thread.isMainThread, "JitsiMeetViewDelegate \(name) method invoked on a non-main thread")+ #endif+ }++ // MARK: - JitsiMeetViewDelegate++ func conferenceJoined(_ data: [AnyHashable: Any]) {+ onJitsiMeetViewDelegateEvent("CONFERENCE_JOINED", withData: data)++ // Register a NSUserActivity for this conference so it can be invoked as a Siri shortcut.+ // Must match the one defined in Info.plist+ let userActivity = NSUserActivity(activityType: "org.jitsi.JitsiMeet.ios.conference")++ if let urlStr = data["url"] as? String,+ let url = URL(string: urlStr),+ let conference = url.pathComponents.last {++ userActivity.title = "Join \(conference)"+ userActivity.suggestedInvocationPhrase = "Join my Jitsi meeting"+ userActivity.userInfo = ["url": urlStr]+ userActivity.isEligibleForSearch = true+ userActivity.isEligibleForPrediction = true+ userActivity.persistentIdentifier = urlStr++ // Subtitle+ let attributes = CSSearchableItemAttributeSet(contentType: UTType.item)+ attributes.contentDescription = urlStr+ userActivity.contentAttributeSet = attributes++ self.userActivity = userActivity+ userActivity.becomeCurrent()+ }+ }++ func ready(toClose data: [AnyHashable: Any]) {+ onJitsiMeetViewDelegateEvent("READY_TO_CLOSE", withData: data)+ }+}