小编Sud*_*lan的帖子

Kotlin 协程如何获取当前线程的 CoroutineScope?

在 Kotlin 协程中,想要为当前线程创建一个引用并在以后使用它。

fun myFuncion(){
    //save current Thread CoroutineScope
    var currentCoroutineScope : CoroutineScope // <How to create?>
    GlobalScope.launch { 
        //Do something 001
        currentCoroutineScope .launch {
            //Do something 002

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙解决这个问题吗?

kotlin kotlin-coroutines

8
推荐指数
1
解决办法
9893
查看次数

如何在ios中排序字典数组

我有这样的dict formate.我需要在字典的dict键中使用"quantity1"键对数组进行排序.

array: (
{
  brand = Ryul;
  productTitle = Any;
  quantity = 1;
  subBrand = "Ryul INJ";
  type = Product;
  dict = {
         brand1 = Trol;
         productTitle1 = Different;
         quantity1 = 2;
         subBrand1 = "";
         type1 = Brand;
      };
},
{
  brand = Trol;
  productTitle = Different;
  quantity = 2;
  subBrand = "";
  type = Brand;
  dict = {
         brand1 = Trol;
         productTitle1 = Different;
         quantity1 = 2;
         subBrand1 = "";
         type1 = Brand;
      };
 }
)
Run Code Online (Sandbox Code Playgroud)

我用这个代码进行排序:

    NSSortDescriptor …
Run Code Online (Sandbox Code Playgroud)

sorting nsdictionary nsarray nssortdescriptor ios

1
推荐指数
1
解决办法
3187
查看次数