Skip to content

Instantly share code, notes, and snippets.

John johncodeos

Block or report user

Report or block johncodeos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View CountdownTimer.swift
class ViewController: UIViewController {
@IBOutlet var timerLabel: UILabel!
var timer: Timer!
override func viewDidLoad() {
super.viewDidLoad()
timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(UpdateTime), userInfo: nil, repeats: true) // Repeat "func Update() " every second and update the label
}
View RemoveCocoaPods.txt
sudo gem install cocoapods-deintegrate
sudo gem install cocoapods-clean
cd (path of your project)
pod deintegrate
pod clean
rm Podfile
View TableViewSwipeToDelete.swift
@available(iOS 11.0, *)
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let deleteAction = UIContextualAction(style: .destructive, title: "Delete") { _, _, complete in
self.Items.remove(at: indexPath.row)
self.tableView.deleteRows(at: [indexPath], with: .automatic)
complete(true)
}
deleteAction.backgroundColor = .red
View AdFragment.kt
class AdFragment: Fragment() {
lateinit var mAdPlacer: MoPubStreamAdPlacer
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val position = arguments!!.getInt(ARG_AD_POSITION)
mAdPlacer.placeAdsInRange(position - 5, position + 5)
return mAdPlacer.getAdView(position, null, container)
}
View Constant.kt
class Constant {
class MoPub {
companion object {
val BANNER_AD_UNIT = "b195f8dd8ded45fe847ad89ed1d016da"
val MAIN_TEXT =
"This app presonalizes your advertising experience " +
"through MoPub, a division of Twitter International " +
"company. By consenting to this enhanced ad " +
View Constant.kt
object Constant {
const val VIEW_TYPE_ITEM = 0
const val VIEW_TYPE_LOADING = 1
}
View Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'LibrariesLicensesExample' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire'
pod 'FLAnimatedImage'
pod 'SDWebImage'
View CustomProgressBar.kt
class CustomProgressBar {
lateinit var dialog: Dialog
fun show(context: Context): Dialog {
return show(context, null)
}
fun show(context: Context, title:CharSequence?): Dialog {
val inflator = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
View styles(v21).xml
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="CustomProgressBarTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
View Communicator.kt
interface Communicator {
fun passDataCom(editext_input: String)
}
You can’t perform that action at this time.