Extra readme, some formatting, and missing file in Helloworld

merge-requests/15/head
QuentinArguillere 3 years ago
parent 98eb474c42
commit d24946be87

1
.gitignore vendored

@ -32,4 +32,5 @@ ios/swift/*/*.xcodeproj/project.xcworkspace/xcuserdata/
ios/swift/*/*.xcodeproj/xcuserdata/ ios/swift/*/*.xcodeproj/xcuserdata/
ios/swift/*/*.xcworkspace/xcuserdata/ ios/swift/*/*.xcworkspace/xcuserdata/
ios/swift/*/build ios/swift/*/build
ios/swift/*/*.xcworkspace

@ -0,0 +1,12 @@
IOS tutorials
====================
Tutorials are written in swift, but the same features can be achieved in objective-C.
Tutorials are numbered 0 to 6, and we recommend you to read them in that order as features from previous tutorials are sometimes used in the next ones, such as account login.
Each tutorial is a full project, so you can generate your Xcode workspace with Cocoapods, build it and deploy it on a real device or an emulator.
Code is being kept as short and simple as possible, and comments explain how and why things are being done.
Full swift API is available [here](http://linphone.org/snapshots/docs/liblinphone/latest/swift).

@ -13,7 +13,7 @@
663D8CE526E8E35500EE487F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 663D8CE426E8E35500EE487F /* Assets.xcassets */; }; 663D8CE526E8E35500EE487F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 663D8CE426E8E35500EE487F /* Assets.xcassets */; };
663D8CE826E8E35500EE487F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 663D8CE726E8E35500EE487F /* Preview Assets.xcassets */; }; 663D8CE826E8E35500EE487F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 663D8CE726E8E35500EE487F /* Preview Assets.xcassets */; };
663D8CEB26E8E35500EE487F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 663D8CE926E8E35500EE487F /* LaunchScreen.storyboard */; }; 663D8CEB26E8E35500EE487F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 663D8CE926E8E35500EE487F /* LaunchScreen.storyboard */; };
663D8CF326E8E73700EE487F /* HelloworldTutorial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 663D8CF226E8E73700EE487F /* HelloworldTutorial.swift */; }; 667C3B4826F1E7B2004D4F14 /* HelloworldTutorial.swift in Sources */ = {isa = PBXBuildFile; fileRef = 667C3B4726F1E7B2004D4F14 /* HelloworldTutorial.swift */; };
AE5DCE54FB07B00CDB39CF8C /* Pods_Helloworld.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 658B93FC56A6311767BE2F24 /* Pods_Helloworld.framework */; }; AE5DCE54FB07B00CDB39CF8C /* Pods_Helloworld.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 658B93FC56A6311767BE2F24 /* Pods_Helloworld.framework */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -28,7 +28,7 @@
663D8CE726E8E35500EE487F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; 663D8CE726E8E35500EE487F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
663D8CEA26E8E35500EE487F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 663D8CEA26E8E35500EE487F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
663D8CEC26E8E35500EE487F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 663D8CEC26E8E35500EE487F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
663D8CF226E8E73700EE487F /* HelloworldTutorial.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = HelloworldTutorial.swift; path = ../../../../Downloads/HelloworldTutorial.swift; sourceTree = "<group>"; }; 667C3B4726F1E7B2004D4F14 /* HelloworldTutorial.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelloworldTutorial.swift; sourceTree = "<group>"; };
B14B29CDA5B52FB0218CB545 /* Pods-Helloworld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Helloworld.release.xcconfig"; path = "Target Support Files/Pods-Helloworld/Pods-Helloworld.release.xcconfig"; sourceTree = "<group>"; }; B14B29CDA5B52FB0218CB545 /* Pods-Helloworld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Helloworld.release.xcconfig"; path = "Target Support Files/Pods-Helloworld/Pods-Helloworld.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -71,8 +71,8 @@
663D8CE426E8E35500EE487F /* Assets.xcassets */, 663D8CE426E8E35500EE487F /* Assets.xcassets */,
663D8CE926E8E35500EE487F /* LaunchScreen.storyboard */, 663D8CE926E8E35500EE487F /* LaunchScreen.storyboard */,
663D8CEC26E8E35500EE487F /* Info.plist */, 663D8CEC26E8E35500EE487F /* Info.plist */,
667C3B4726F1E7B2004D4F14 /* HelloworldTutorial.swift */,
663D8CE626E8E35500EE487F /* Preview Content */, 663D8CE626E8E35500EE487F /* Preview Content */,
663D8CF226E8E73700EE487F /* HelloworldTutorial.swift */,
); );
path = Helloworld; path = Helloworld;
sourceTree = "<group>"; sourceTree = "<group>";
@ -219,7 +219,7 @@
663D8CDF26E8E35400EE487F /* AppDelegate.swift in Sources */, 663D8CDF26E8E35400EE487F /* AppDelegate.swift in Sources */,
663D8CE126E8E35400EE487F /* SceneDelegate.swift in Sources */, 663D8CE126E8E35400EE487F /* SceneDelegate.swift in Sources */,
663D8CE326E8E35400EE487F /* ContentView.swift in Sources */, 663D8CE326E8E35400EE487F /* ContentView.swift in Sources */,
663D8CF326E8E73700EE487F /* HelloworldTutorial.swift in Sources */, 667C3B4826F1E7B2004D4F14 /* HelloworldTutorial.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

@ -0,0 +1,58 @@
//
// HellowolrdTutorial.swift
// HellowolrdTutorial
//
// Created by QuentinArguillere on 08/09/2021.
// Copyright © 2021 BelledonneCommunications. All rights reserved.
//
// Check the Podfile to see how to import the LibLinphone SDK !!!
import linphonesw
class HelloworldTutorialContext : ObservableObject
{
var mCore: Core!
@Published var coreVersion: String = Core.getVersion
/*------------ Login tutorial related variables -------*/
var mRegistrationDelegate : CoreDelegate!
@Published var username : String = "user"
@Published var passwd : String = "pwd"
@Published var domain : String = "sip.example.org"
@Published var loggedIn: Bool = false
@Published var transportType : String = "TLS"
init()
{
// Some configuration can be done before the Core is created, for example enable debug logs.
LoggingService.Instance.logLevel = LogLevel.Debug
// Core is the main object of the SDK. You can't do much without it.
// To create a Core, we need the instance of the Factory.
let factory = Factory.Instance
// Your Core can use up to 2 configuration files, but that isn't mandatory.
try! mCore = factory.createCore(configPath: "", factoryConfigPath: "", systemContext: nil)
try! mCore.start()
// Create a Core listener to listen for the callback we need
// In this case, we want to know about the account registration status
mRegistrationDelegate = CoreDelegateStub(onAccountRegistrationStateChanged: { (core: Core, account: Account, state: RegistrationState, message: String) in
// If account has been configured correctly, we will go through Progress and Ok states
// Otherwise, we will be Failed.
NSLog("New registration state is \(state) for user id \( String(describing: account.params?.identityAddress?.asString()))\n")
if (state == .Ok) {
self.loggedIn = true
} else if (state == .Cleared) {
self.loggedIn = false
}
})
mCore.addDelegate(delegate: mRegistrationDelegate)
coreVersion = Core.getVersion
// Now we can start using the Core object
}
}

@ -16,9 +16,9 @@ class CallKitExampleContext : ObservableObject
var mAccount: Account? var mAccount: Account?
var mCoreDelegate : CoreDelegate! var mCoreDelegate : CoreDelegate!
@Published var username : String = "quentindev" @Published var username : String = "user"
@Published var passwd : String = "dev" @Published var passwd : String = "pwd"
@Published var domain : String = "sip.linphone.org" @Published var domain : String = "sip.example.org"
@Published var loggedIn: Bool = false @Published var loggedIn: Bool = false
@Published var transportType : String = "TLS" @Published var transportType : String = "TLS"

Loading…
Cancel
Save