This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sasliderdemo.salmaan.ahmsal.com.flagchatadapter | |
import android.content.Context | |
import android.support.v4.content.ContextCompat | |
import android.view.View | |
import android.widget.Toast | |
import java.util.* | |
/** | |
* Created by salmaanahmed on 04/09/2018. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sasliderdemo.salmaan.ahmsal.com.flagchatadapter | |
import android.content.Context | |
import android.support.v4.content.ContextCompat | |
import android.support.v7.widget.RecyclerView | |
import android.view.Gravity | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import android.view.animation.Animation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package sasliderdemo.salmaan.ahmsal.com.flagchatadapter | |
import android.content.Context | |
import android.support.v4.content.ContextCompat | |
import android.view.View | |
import android.widget.Toast | |
import java.util.* | |
/** | |
* Created by salmaanahmed on 04/09/2018. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<set xmlns:android="http://schemas.android.com/apk/res/android"> | |
<translate | |
android:duration="1000" | |
android:fillAfter="true" | |
android:fromYDelta="99%p" | |
android:toYDelta="0%p" /> | |
</set> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Result<Wrapped, Failure> { | |
case value(Wrapped) | |
case error(Failure) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URLSession.shared.dataTask(with: url) { (result: Result<(response: URLResponse, data: Data), Error>) in // Type added for illustration purposes. | |
switch result { | |
case let .success(success): | |
handleResponse(success.response, data: success.data) | |
case let .error(error): | |
handleError(error) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift: | |
7 % 2 == 1 // true | |
-7 % 2 == 1 // false. -7 % 2 evaluates to -1 | |
// Ruby and Python | |
7 % 2 == 1 // true | |
-7 % 2 == 1 // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On protocol BinaryInteger | |
@_transparent | |
public var isEven: Bool { return _lowWord % 2 == 0 } | |
@_transparent | |
public var isOdd: Bool { return !isEven } | |
func isMultiple(of other: Self) -> Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if !swift(>=4.2) | |
// This will only be executed if the Swift version is less than 4.2. | |
#endif | |
#if !compiler(>=4.2) | |
// This will only be executed if the Swift compiler version is less than 4.2. | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if swift(<4.2) | |
// This will only be executed if the Swift version is less than 4.2. | |
#endif | |
#if compiler(<4.2) | |
// This will only be executed if the Swift compiler version is less than 4.2. | |
#endif |
OlderNewer