Swiftpack.co - Package - leancloud/swift-sdk

LeanCloud Swift SDK

Build Status Coverage Status

Features

  • [x] Data Storage
  • [x] Object Query
  • [x] Cloud Engine
  • [x] Short Message
  • [x] File Hosting
  • [x] Push Notification
  • [x] Instant Messaging

Communication

  • If you have some advice, open an issue.
  • If you found a bug, open an issue, or open a ticket in [LeanTicket][LeanTicket].
  • If you want to contribute, submit a pull request.

Installation & Quick Start

Please read this documentation.

Github

link
Stars: 99

Used By

Total: 0

Releases

17.6.1 - 2020-08-31 09:15:55

πŸš€ New Features

  • feat(storage): support apple sign in (#391)

πŸ› Bug Fixes

  • fix(im): name of file message (#392)
  • fix(im): key-muted and key-joinedAt handling of system conversation (#388)

17.6.0 - 2020-07-17 09:48:50

πŸš€ New Features

  • feat(rtm): embed Starscream and enhance read buffer size (#383)
  • feat(user): bind or change phone number by sms code (#382)
  • feat(query): static functions of or & and (#381)
  • feat(query): make some properties public (#378)

πŸ› Bug Fixes

  • fix(query): copy, encode and decode is not right (#379)

🧰 Maintenance

  • refactor(ws): resolve some compiler warnings (#385)
  • docs(query): tweak description (#376)

17.5.7 - 2020-07-07 10:00:33

πŸš€ New Features

  • feat(rtm): throttling command and omit peer-id (#373)

17.5.6 - 2020-06-23 04:26:48

πŸ› Bug Fixes

  • fix(im): message ack error handling not right (#370)

🧰 Maintenance

  • refactor: http response on internal queue (#364)
  • refactor: checking of application and client (#362)
  • refactor: registry (#361)

17.5.5 - 2020-05-09 08:36:51

πŸš€ New Features

  • feat(flutter): custom typed message (#359)

17.5.4 - 2020-05-06 09:29:11

πŸš€ New Features

  • feat(push): support extra parameters (#356)

17.5.3 - 2020-05-01 08:33:06

πŸ› Bug Fixes

  • fix(rtm): discard websocket in wrong way (#354)

17.5.2 - 2020-02-24 07:41:45

πŸ› Bug Fixes

  • fix(IM): add a property for recalled message to indicate whether generated by recalling message function (#347)

17.5.1 - 2020-02-23 11:23:19

πŸ› Bug Fixes

  • fix(IM): rcp event should not update last delivered & read date (#345)
  • fix(IM): set unread mentioned to false after invoke read (#343)
  • fix(IM): mark recall when recalling message (#342)

17.5.0 - 2020-02-20 07:46:14

πŸš€ New Features

  • feat(dependencies): bump to latest minor version (#337)
  • feat(IM): support checking whether joined conversation (#336)
  • feat(date): public iso string (#335)
  • feat(IM): last delivered & read date property, fetch receipt timestamp function for conversation (#334)
  • feat(file): property option for keep file name (#332)
  • feat(IM): function for getting temporary conversation by id (#331)
  • feat(IM): padding raw data of conversation after creation (#330)

17.4.6 - 2020-02-14 10:27:00

πŸ› Bug Fixes

  • fix(IM): connection disconnect by timeout should not do reconencting (#327)

17.4.5 - 2020-02-10 07:08:34

πŸ› Bug Fixes

  • fix(IM): client close without peer-id (#325)

17.4.4 - 2020-02-05 10:18:41

πŸ› Bug Fixes

  • fix(date): format representation string of date is incorrect in some region (#322)

17.4.3 - 2020-01-14 09:32:35

πŸš€ New Features

  • feat(IM): new session open option 'reconnect' (#319)
  • feat(IM): async counting members function of conversation (#318)

17.4.2 - 2020-01-06 10:09:37

πŸš€ New Features

  • feat(IM): conversation query can set where condition string directly (#313)

🧰 Maintenance

  • refactor(error): formatted description (#314)

17.4.1 - 2020-01-02 10:32:05

πŸš€ New Features

  • feat(IM): expose transient indicator of message (#310)
  • feat(IM): expose raw data getter of conversation (#308)

πŸ› Bug Fixes

  • fix(IM): conversation decode binary last message is incorrect (#306)

🧰 Maintenance

  • refactor(sms): make templateName and signatureName optional & update code comment (#311)

17.4.0 - 2019-12-19 12:06:50

πŸš€ New Features

Foundation

  • feat: complete completion queue support (#300) (#297)

    all async function support setting queue of result callback. the parameter is completionQueue: DispatchQueue, default is DispatchQueue.main.

  • feat(LCObject): operation for key path (#296)

    code e.g.

     // An exist object has a `Dictionary` field.
     let object = LCObject(objectId: "<valid-id>")
     object["dictionary"] = LCDictionary()
    
     // can use key-path to update key-value in dictionary.
     object["dictionary.foo"] = "bar"
    
     // result is `["foo": "bar"]`
     print(object["dictionary"]!.dictionaryValue!)
    

    only an object has a valid ID can use key-path to update data. Relation Operation is unavailable for key-path.

  • feat(LCFile): keep file name (#291)

    new save option keepFileName for LCFile. it will generate a URL that last path component is the name of LCFile.

  • feat(LCFile): progress queue of LCFile (#290)

    new parameter progressQueue: DispatchQueue for async save function. can use it to set callback queue of progress, default is DispatchQueue.main.

  • feat(LCValue): all LCValue can init from same type (#288)

    code e.g.

     let number1 = LCNumber(42)
     let number2 = LCNumber(number1)
     print(number1 == number2) // true
     print(number1 !== number2) // true
    
     let string1 = LCString("foo")
     let string2 = LCString(string1)
     print(string1 == string2) // true
     print(string1 !== string2) // true
    
     let array1 = LCArray([number1, string1])
     let array2 = LCArray(array1)
     print(array1 == array2) // true
     print(array1 !== array2) // true
    
     let dictionary1 = LCDictionary([string1.value: number1])
     let dictionary2 = LCDictionary(dictionary1)
     print(dictionary1 == dictionary2) // true
     print(dictionary1 !== dictionary2) // true
    
  • feat(LCValue): expressible by array literal of LCArray support LCValueConvertible (#278)

    code e.g.

     let _: LCArray = ["a"]
     let _: LCArray = ["a", 1]
     let _: LCArray = ["a", LCNumber(1)]
     let _: LCArray = [LCString("a"), 1]
     let _: LCArray = [LCString("a"), LCNumber(1)]
    

RTM

  • feat(IMServiceConversation): add joined property for system conversation (#298)

    new property public var isSubscribed: Bool? { get } of IMServiceConversation. can use it to check whether the client has subscribed the conversation.

  • feat(IMCategorizedMessage): change IMCategorizedMessage.rawData.get to public (#280)

πŸ› Bug Fixes

  • fix(IM): start unique conversation not invoke local storage saving (#299)

    use creating unique conversation to get an exist conversation, it may not save data of conversation to local storage.

  • fix(storage): sequence of array operation is not right (#295)

    it may cause local data and server data are inconsistent.

  • fix(storage): linking object with unsaved file not throw error (#286)

    only a saved file can be link to an object.

  • fix(storage): batch save can do with empty requests (#284)

    empty requests will not be posted, it return success directly.

🧰 Maintenance

  • refactor(IM): created and updated date of conversation (#300)

    API diff: conversation property updatedAt will be nil after creating a new instance, should use createdAt in this condition.

  • refactor(IM): make APIs of local storage unavailable when can not import GRDB (#279)

    API diff: Code Completion will not show APIs about IM Local Storage when use RTM-no-local-storage mode.

17.3.2 - 2019-12-02 10:58:26

πŸ› Bug Fixes

  • fix: top object may post __type & className keys (#274)
    • __type and className are reserved key by server

🧰 Maintenance

  • refactor(user): part of auth data (#276)
  • refactor(engine): docs update and completion queue for async-function (#275)
  • refactor(user): make result of async-function discardable (#273)
  • docs(IM): update IMConversation.send() docs (#272)

17.3.1 - 2019-11-25 06:37:12

πŸ› Bug Fixes

  • fix(RTM): WebSocket Request should not include "Origin" Header (#269)
    • it casue RTM unavailable when application set Web-Secure-Domain

17.3.0 - 2019-11-23 09:41:17

πŸš€ New Features

  • feat(IM): dependencies for local storage of IM be optional

    SDK can be integrated without dependencies of IM-Local-Storage module by CocoaPods:

    pod 'LeanCloud/RTM-no-local-storage'

    in this way, GRDB.swift will not be a dependency for SDK and the APIs of IM-Local-Storage will be unavailable.

  • feat(storage): LCObject and LCDictionary’s subscript support value-convertible

    e.g.

     let object = LCObject()
     object[β€œfoo”] = β€œbar”
     object[β€œnumber”] = 42
     object[β€œboolean”] = true
    
     let dictionary = LCDictionary()
     dictionary[β€œfoo”] = β€œbar”
     dictionary[β€œnumber”] = 42
     dictionary[β€œboolean”] = true	
    

πŸ› Bug Fixes

  • fix(storage): crash by value converting

    below APIs will cause crash in old version:

    • LCValue.arrayValue
    • LCValue.dictionaryValue
    • LCArray.rawValue
    • LCDictionary.rawValue

    to fix it, change type of LCValue.rawValue from LCValueConvertible to Any

  • fix(storage): LCObject retain self

    • it cause memory leak
  • fix(storage): LCObject not implement value(forUndefinedKey:)

    • it may cause an exception throws by system

17.2.0 - 2019-11-12 10:57:09

πŸš€ New Features

  • feat(IM): failed message caching

    New API for IMConversation

     public func insertFailedMessageToCache(_ message: IMMessage, completion: @escaping (LCBooleanResult) -> Void) throws
     
     public func removeFailedMessageFromCache(_ message: IMMessage, completion: @escaping (LCBooleanResult) -> Void) throws
    
  • feat(storage): thumbnail url for qiniu url

    New API for LCFile

     public enum Thumbnail {
     	case scale(Double)
     	case size(width: Double, height: Double)
     }
    
     public func thumbnailURL(_ thumbnail: Thumbnail) -> URL?
    

πŸ› Bug Fixes

  • fix(storage): bool value converting not right
    • this bug cause LCBool(true).boolValue == nil

17.1.0 - 2019-10-24 11:35:02

πŸš€ New Features

  • feat(storage): auto cache(local-disk) of current user

     let defaultApplication = LCApplication.default
    
     /* Caching User */
     // Any User-Login-API will cache user(memory and local-disk) automatically when result is success
    
     /* Get Cached User */
     if let cachedUser = defaultApplication.currentUser {
     	// Current User Cache(memory or local-disk) exist
     }
    
     /* Clear Cached User(memory and local-disk) */
     // Two Ways
     defaultApplication.currentUser = nil // method 1
     LCUser.logOut(application: defaultApplication) // method 2
    
  • feat(storage): cache policy of query functions

    • new parameter cachePolicy: CachePolicy for the related APIs, the default is onlyNetwork
     // Cache Policy Enumeration
     public enum CachePolicy {
     	case onlyNetwork
     	case onlyCache
     	case networkElseCache
     }
    

    This feature is not enable in default, so before usage, should set up HTTPURLCache of LCApplication.Configuration to open it.

  • feat(storage): completion queue of async query functions

    • new parameter completionQueue: DispatchQueue for the related APIs, the default is main

🧰 Maintenance

  • chore: update dependency

17.0.0 - 2019-10-08 13:21:49

⚠️ Breaking Changes

  • feat!(platforms): not support iOS 8 and 9 any more

  • feat!(dependencies): upgrade Alamofire from 4 to 5

  • feat!(dependencies): replace FMDB with GRDB

  • feat!(foundation): app-router not support ChinaNorth and ChinaEast application

    if application belong to ChinaNorth or ChinaEast, should use below method to initialize:

     try LCApplication.default.set(
         id: {{appid}},
         key: {{appkey}},
         serverURL: "https://xxx.example.com")
    
  • feat!(integration): rename subspec of pod

    from:

     pod 'LeanCloud/Storage'
     pod 'LeanCloud/IM'
    

    change to:

     pod 'LeanCloud/Foundation'
     pod 'LeanCloud/RTM'	
    
  • feat!(foundation): use struct wrap version of SDK

    from:

     let version: String = LeanCloud.version
    

    to:

     let version: String = LeanCloud.Version.versionString
    

πŸš€ New Features

  • feat(integration): support Swift Package Manager

  • feat(IM): change access level of default media message from public to open

    classes of default media message:

    • IMCategorizedMessage
    • IMTextMessage
    • IMImageMessage
    • IMAudioMessage
    • IMVideoMessage
    • IMFileMessage
    • IMLocationMessage
    • IMRecalledMessage
  • feat(storage): parameter completionQueue: DispatchQueue for LCFile saving functions

πŸ› Bug Fixes

  • fix(storage): POST request may carry some dirty data
  • fix(IM): make member managing of chat room available
  • fix(IM): signature for member changing and blacklist not support transient and system conversation
  • fix(IM): priority of token and signature when opening
  • fix(storage): deadlock of LCFile.save()

🧰 Maintenance

  • chore(dependencies): upgrade SwiftProtobuf to 1.7.0

17.0.0-beta.3 - 2019-09-25 08:44:34

Optimization and fixed bugs

  • merge master

17.0.0-beta.2 - 2019-09-25 07:56:55

Break changes

  • feat!: remove app router and fallback url of cn, ce
  • feat!: rename subspec of pod
  • feat!: use struct wrap version

New features

  • feat: application server url
  • feat(IM): change access level of default media message to open

16.5.1 - 2019-09-18 04:44:14

Optimization and fixed bugs

  • fix(storage): post dirty data
  • fix(IM): assertion abusing of client internal queue

17.0.0-beta.1 - 2019-09-11 09:30:43

Break changes

  • feat!: not support iOS 8 and 9 any more
  • feat!: replace FMDB with GRDB
  • feat!: upgrade Alamofire to 5.0.0

New features

  • feat: support Swift Package Manager

Optimization and fixed bugs

  • fix(storage): maybe post dirty data

16.5.0 - 2019-08-13 06:31:46

New features

  • Live Query

Optimization and fixed bugs

  • fix: some incorrect logic for decoding error from http response
  • fix(IM): add a public function for getting member info
  • fix(IM): client init with user not support signature of open action

16.4.0 - 2019-07-22 07:53:24

New features

  • feat(IM): conversation member info management
  • feat(IM): conversation blocking member
  • feat(IM): conversation muting members

Optimization and fixed bugs

  • fix(storage): bug of query with multiple order
  • chore: bump swift-protobuf to 1.6.0

16.3.0 - 2019-07-11 10:56:21

New features

  • feat(storage): support fetch with keys
  • feat(storage): support object save option
  • feat(storage): support query result return acl
  • feat(storage): environment configuration of the application
  • feat(storage): add synchronously function for captcha client
  • feat(push): support push
  • feat(IM): client init with User
  • feat(IM): support signature for client open
  • feat(IM): support signature for conversation creation
  • feat(IM): support signature for conversation member change

Optimization and fixed bugs

  • fix(engine): cloud run return json and rpc return object